<!DOCTYPE html>
<!-- saved from url=(0091)./images.html#images-save-image-path-format-png-quality-100 -->
<html lang="zh-CN" data-theme="light" class=" ">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <meta name="generator" content="VuePress 2.0.0-beta.51" />
    <meta name="theme" content="VuePress Theme Hope" />
    <meta property="og:url" content="images.html">
    <meta property="og:site_name" content="Auto.js Pro文档">
    <meta property="og:title" content="images - 图片处理">
    <meta property="og:type" content="article">
    <meta property="og:updated_time" content="2022-10-22T07:36:15.000Z">
    <meta property="og:locale" content="zh-CN">
    <meta property="og:locale:alternate" content="en-US">
    <meta property="article:modified_time" content="2022-10-22T07:36:15.000Z">
    <link rel="alternate" hreflang="en-us" href="images.html">
    <link rel="icon" href="./docs/favicon.ico">
    <link rel="manifest" href="./docs/manifest.webmanifest" crossorigin="use-credentials">
    <meta name="theme-color" content="#46bd87">
    <meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
    <title>images - 图片处理 | Auto.js Pro文档</title>
    <meta name="description" content="支持Node.js的自动化工作流JavaScript IDE">
    <style>
      :root {
        --bg-color: #fff;
      }
  
      html[data-theme="dark"] {
        --bg-color: #1d2025;
      }
  
      html,
      body {
        background-color: var(--bg-color);
      }
    </style>
    <script>
      const userMode = localStorage.getItem("vuepress-theme-hope-scheme");
      const systemDarkMode =
        window.matchMedia &&
        window.matchMedia("(prefers-color-scheme: dark)").matches;
  
      if (userMode === "dark" || (userMode !== "light" && systemDarkMode)) {
        document.querySelector("html").setAttribute("data-theme", "dark");
      }
    </script>
    <link rel="stylesheet" href="../../assets/style.ae9cb182.css">
    <link rel="modulepreload" href="../../assets/app.6aa2b576.js">
    <link rel="modulepreload" href="../../assets/app.html.004a89b7.js">
    <link rel="modulepreload" href="../../assets/_plugin-vue_export-helper.cdc0426e.js">
    <link rel="modulepreload" href="../../assets/app.html.79d7bc17.js">
  </head>
  
  <body>
    <!-- Copyright � 2008. Spidersoft Ltd -->
    <style>
      A.applink:hover {
        border: 2px dotted #DCE6F4;
        padding: 2px;
        background-color: #ffff00;
        color: green;
        text-decoration: none
      }
  
      A.applink {
        border: 2px dotted #DCE6F4;
        padding: 2px;
        color: #2F5BFF;
        background: transparent;
        text-decoration: none
      }
  
      A.info {
        color: #2F5BFF;
        background: transparent;
        text-decoration: none
      }
  
      A.info:hover {
        color: green;
        background: transparent;
        text-decoration: underline
      }
    </style>
  
  
    <div id="app"><!--[--><!--[--><!--[--><span tabindex="-1"></span><a href="#main-content"
        class="skip-link sr-only">Skip to content</a><!--]-->
      <div class="theme-container has-toc"><!--[--><!--[-->
        <header class="navbar">
          <div class="navbar-left"><button class="toggle-sidebar-button" title="Toggle Sidebar"><span
                class="icon"></span></button><!----><a href="../../docs.html" class="brand"><img class="logo"
                src="../../logo.png" alt="Auto.js Pro文档"><!----><span class="site-name hide-in-pad">Auto.js
                Pro文档</span></a><!----></div>
          <div class="navbar-center"><!---->
            <nav class="nav-links">
              <div class="nav-item hide-in-mobile"><a href="../../docs.html" class="nav-link"
                  aria-label="Auto.js Pro"><span class="icon iconfont icon-home"></span>Auto.js Pro<!----></a></div>
              <div class="nav-item hide-in-mobile"><a href="../guide/guide.html" class="nav-link" aria-label="指南"><span
                    class="icon iconfont icon-creative"></span>指南<!----></a></div>
              <div class="nav-item hide-in-mobile"><a href="v8.html" class="nav-link active" aria-label="第一代API文档"><span
                    class="icon iconfont icon-note"></span>第一代API文档<!----></a></div>
              <div class="nav-item hide-in-mobile"><a href="../v9/v9.html" class="nav-link" aria-label="第二代API文档"><span
                    class="icon iconfont icon-note"></span>第二代API文档<!----></a></div>
              <div class="nav-item hide-in-mobile">
                <div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="官网与相关链接"><span
                      class="title"><span class="icon iconfont icon-discover"></span>官网与相关链接</span><span
                      class="arrow"></span>
                    <ul class="nav-dropdown">
                      <li class="dropdown-item"><a href="../../../pro.autojs.html" rel="noopener noreferrer"
                          target="_blank" aria-label="官网与软件下载" class="nav-link"><!---->官网与软件下载<span><svg
                              class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                              focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                              <path fill="currentColor"
                                d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                              </path>
                              <polygon fill="currentColor"
                                points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                              </polygon>
                            </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                      </li>
                      <li class="dropdown-item"><a href="https://blog.autojs.org/" rel="noopener noreferrer"
                          target="_blank" aria-label="官方博客" class="nav-link"><!---->官方博客<span><svg
                              class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                              focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                              <path fill="currentColor"
                                d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                              </path>
                              <polygon fill="currentColor"
                                points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                              </polygon>
                            </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                      </li>
                      <li class="dropdown-item"><a href="https://pd.qq.com/s/gosos5" rel="noopener noreferrer"
                          target="_blank" aria-label="官方频道" class="nav-link"><!---->官方频道<span><svg
                              class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                              focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                              <path fill="currentColor"
                                d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                              </path>
                              <polygon fill="currentColor"
                                points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                              </polygon>
                            </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                      </li>
                    </ul>
                  </button></div>
              </div>
            </nav><!---->
          </div>
                <div class="navbar-right"><!---->
                    <div class="nav-item">
                        <div class="dropdown-wrapper i18n-dropdown"><button class="dropdown-title" type="button"
                                aria-label="选择语言"><!--[--><svg xmlns="http://www.w3.org/2000/svg" class="icon i18n-icon"
                                    viewBox="0 0 1024 1024" fill="currentColor" aria-label="i18n icon"
                                    style="width:1rem;height:1rem;vertical-align:middle;">
                                    <path
                                        d="M379.392 460.8 494.08 575.488l-42.496 102.4L307.2 532.48 138.24 701.44l-71.68-72.704L234.496 460.8l-45.056-45.056c-27.136-27.136-51.2-66.56-66.56-108.544h112.64c7.68 14.336 16.896 27.136 26.112 35.84l45.568 46.08 45.056-45.056C382.976 312.32 409.6 247.808 409.6 204.8H0V102.4h256V0h102.4v102.4h256v102.4H512c0 70.144-37.888 161.28-87.04 210.944L378.88 460.8zM576 870.4 512 1024H409.6l256-614.4H768l256 614.4H921.6l-64-153.6H576zM618.496 768h196.608L716.8 532.48 618.496 768z">
                                    </path>
                                </svg><!--]--><span class="arrow"></span>
                                <ul class="nav-dropdown">
                                    <li class="dropdown-item"><a href="https://pro.autojs.org/docs/en/" class="nav-link"
                                            aria-label="English"><!---->English<!----></a></li>
                                    <li class="dropdown-item"><a aria-current="page"
                                            href="./images.html"
                                            class="router-link-active router-link-exact-active nav-link active"
                                            aria-label="简体中文"><!---->简体中文<!----></a></li>
                                </ul>
                            </button></div>
                    </div><!---->
                    <div class="nav-item hide-in-mobile"><button id="appearance-switch"><svg
                                xmlns="http://www.w3.org/2000/svg" class="icon auto-icon" viewBox="0 0 1024 1024"
                                fill="currentColor" aria-label="auto icon" style="display:block;">
                                <path
                                    d="M512 992C246.92 992 32 777.08 32 512S246.92 32 512 32s480 214.92 480 480-214.92 480-480 480zm0-840c-198.78 0-360 161.22-360 360 0 198.84 161.22 360 360 360s360-161.16 360-360c0-198.78-161.22-360-360-360zm0 660V212c165.72 0 300 134.34 300 300 0 165.72-134.28 300-300 300z">
                                </path>
                            </svg><svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" viewBox="0 0 1024 1024"
                                fill="currentColor" aria-label="dark icon" style="display:none;">
                                <path
                                    d="M524.8 938.667h-4.267a439.893 439.893 0 0 1-313.173-134.4 446.293 446.293 0 0 1-11.093-597.334A432.213 432.213 0 0 1 366.933 90.027a42.667 42.667 0 0 1 45.227 9.386 42.667 42.667 0 0 1 10.24 42.667 358.4 358.4 0 0 0 82.773 375.893 361.387 361.387 0 0 0 376.747 82.774 42.667 42.667 0 0 1 54.187 55.04 433.493 433.493 0 0 1-99.84 154.88 438.613 438.613 0 0 1-311.467 128z">
                                </path>
                            </svg><svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon"
                                viewBox="0 0 1024 1024" fill="currentColor" aria-label="light icon"
                                style="display:none;">
                                <path
                                    d="M952 552h-80a40 40 0 0 1 0-80h80a40 40 0 0 1 0 80zM801.88 280.08a41 41 0 0 1-57.96-57.96l57.96-58a41.04 41.04 0 0 1 58 58l-58 57.96zM512 752a240 240 0 1 1 0-480 240 240 0 0 1 0 480zm0-560a40 40 0 0 1-40-40V72a40 40 0 0 1 80 0v80a40 40 0 0 1-40 40zm-289.88 88.08-58-57.96a41.04 41.04 0 0 1 58-58l57.96 58a41 41 0 0 1-57.96 57.96zM192 512a40 40 0 0 1-40 40H72a40 40 0 0 1 0-80h80a40 40 0 0 1 40 40zm30.12 231.92a41 41 0 0 1 57.96 57.96l-57.96 58a41.04 41.04 0 0 1-58-58l58-57.96zM512 832a40 40 0 0 1 40 40v80a40 40 0 0 1-80 0v-80a40 40 0 0 1 40-40zm289.88-88.08 58 57.96a41.04 41.04 0 0 1-58 58l-57.96-58a41 41 0 0 1 57.96-57.96z">
                                </path>
                            </svg></button></div>
                    <div class="search-box" role="search" data-v-f3875574=""><input value="" aria-label="Search"
                            class="" placeholder="Search" autocomplete="off" spellcheck="false"
                            data-v-f3875574=""><!----></div><!----><button class="toggle-navbar-button"
                        aria-label="Toggle Navbar" aria-expanded="false" aria-controls="nav-screen"><span
                            class="button-container"><span class="button-top"></span><span
                                class="button-middle"></span><span class="button-bottom"></span></span></button>
                </div>
            </header><!----><!--]--><!---->
            <div class="toggle-sidebar-wrapper"><span class="arrow left"></span></div>
            <aside class="sidebar"><!--[--><!----><!--]-->
                <ul class="sidebar-links">
                    <li>
                        <section class="sidebar-group">
                            <p class="sidebar-heading"><!----><span class="title">指南</span><!----></p>
                            <ul class="sidebar-links">
                                <li><!--[--><a href="./"
                                        class="nav-link sidebar-link sidebar-page"
                                        aria-label="阅读须知"><!---->阅读须知<!----></a>
                                    <ul class="sidebar-sub-headers"></ul><!--]-->
                                </li>
                            </ul>
                        </section>
                    </li>
                    <li>
                        <section class="sidebar-group">
                            <p class="sidebar-heading"><!----><span class="title">API文档</span><!----></p>
                            <ul class="sidebar-links">
                              <li>
                                <section class="sidebar-group"><button class="sidebar-heading clickable"><!----><span
                                      class="title">自动化 -
                                      控件操作</span><span class="arrow down"></span></button>
                                  <ul class="sidebar-links">
                                    <li><!--[--><a href="./automator/"
                                        class="router-link-active router-link-exact-active nav-link sidebar-link sidebar-page"
                                        aria-label="入门介绍" aria-current="page"><!---->入门介绍<!----></a>
                                      <ul class="sidebar-sub-headers"></ul><!--]-->
                                    </li>
                                    <li><!--[--><a href="./automator/selector.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="选择器"><!---->选择器<!----></a>
                                      <ul class="sidebar-sub-headers"></ul><!--]-->
                                    </li>
                                    <li><!--[--><a href="./automator/uiobject.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="控件和控件集合"><!---->控件和控件集合<!----></a>
                                      <ul class="sidebar-sub-headers"></ul><!--]-->
                                    </li>
                                    <li><!--[--><a href="./automator/api.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="automator与其他函数"><!---->automator与其他函数<!----></a>
                                      <ul class="sidebar-sub-headers"></ul><!--]-->
                                    </li>
                                  </ul>
                                </section>
                              </li>
                              <li><!--[--><a href="./coordinatesBasedAutomation.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="自动化 - 坐标操作"><!---->自动化 -
                                  坐标操作<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./app.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="app - 应用"><!---->app -
                                  应用<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./base64.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="base64"><!---->base64<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./colors.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="colors - 颜色"><!---->colors - 颜色<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./canvas.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="canvas - 画布"><!---->canvas - 画布<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./console.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="console - 控制台"><!---->console - 控制台<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./crypto.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="crypto - 加解密与消息摘要"><!---->crypto - 加解密与消息摘要<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./debug.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="debug - 调试工具"><!---->debug - 调试工具<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./device.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="device - 设备"><!---->device - 设备<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./dialogs.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="dialogs - 对话框"><!---->dialogs - 对话框<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./engines.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="engines - 脚本引擎"><!---->engines - 脚本引擎<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./events.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="events - 事件与监听"><!---->events - 事件与监听<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./floaty.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="floaty - 悬浮窗"><!---->floaty - 悬浮窗<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./files.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="files - 文件系统"><!---->files - 文件系统<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./globals.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="globals - 全局变量与函数"><!---->globals - 全局变量与函数<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./http.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="http - HTTP网络请求"><!---->http - HTTP网络请求<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./images.html" class="nav-link sidebar-link sidebar-page active"
                                  aria-label="images - 图片处理"><!---->images - 图片处理<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./keys.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="keys - 按键模拟"><!---->keys
                                  - 按键模拟<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./media.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="media - 多媒体"><!---->media
                                  - 多媒体<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./modules.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="module - 模块"><!---->module - 模块<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./ocr.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="ocr - 文字识别"><!---->ocr -
                                  文字识别<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./plugins.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="plugins - 插件"><!---->plugins - 插件<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./powerManager.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="power_manager - 电源管理"><!---->power_manager - 电源管理<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./sensors.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="sensors - 传感器"><!---->sensors - 传感器<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./shell.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="shell - Shell命令"><!---->shell - Shell命令<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./storages.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="storages - 本地存储"><!---->storages - 本地存储<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./settings.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="settings - 设置"><!---->settings - 设置<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./threads.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="threads - 多线程"><!---->threads - 多线程<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./timers.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="timers - 定时器"><!---->timers - 定时器<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./timedTasks.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="work_manager - 定时与任务"><!---->work_manager - 定时与任务<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li>
                                <section class="sidebar-group"><button class="sidebar-heading clickable"><!----><span
                                      class="title">ui - 用户界面</span><span class="arrow down"></span></button>
                                  <ul class="sidebar-links">
                                    <li><a href="/docs/zh/v8/ui/ui.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="ui入门介绍"><!---->ui入门介绍<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                    <li><a href="/docs/zh/v8/ui/basic.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="基础布局与控件"><!---->基础布局与控件<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                    <li><a href="/docs/zh/v8/ui/advanced.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="其他布局与控件"><!---->其他布局与控件<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                    <li><a href="/docs/zh/v8/ui/api.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="api文档"><!---->api文档<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                    <li><a href="/docs/zh/v8/ui/customWidget.html" class="nav-link sidebar-link sidebar-page"
                                        aria-label="自定义控件"><!---->自定义控件<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                    <li><a aria-current="page" href="/docs/zh/v8/ui/webview.html"
                                        class="router-link-active router-link-exact-active nav-link sidebar-link sidebar-page"
                                        aria-label="使用Web编写界面"><!---->使用Web编写界面<!----></a>
                                      <ul class="sidebar-sub-headers"></ul>
                                    </li>
                                  </ul>
                                </section>
                              </li>
                              <li><!--[--><a href="./util.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="util - 工具"><!---->util -
                                  工具<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./webSocket.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="WebSocket"><!---->WebSocket<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                              <li><!--[--><a href="./zip.html" class="nav-link sidebar-link sidebar-page"
                                  aria-label="zip - 压缩与解压"><!---->zip -
                                  压缩与解压<!----></a>
                                <ul class="sidebar-sub-headers"></ul><!--]-->
                              </li>
                            </ul>
                          </section>
                    </li>
                    <li>
                        <section class="sidebar-group">
                            <p class="sidebar-heading"><!----><span class="title">进阶</span><!----></p>
                            <ul class="sidebar-links">
                                <li><!--[--><a href="./scriptingJava.html"
                                        class="nav-link sidebar-link sidebar-page"
                                        aria-label="和Java交互"><!---->和Java交互<!----></a>
                                    <ul class="sidebar-sub-headers"></ul><!--]-->
                                </li>
                            </ul>
                        </section>
                    </li>
                </ul><!--[--><!----><!--]-->
            </aside><!--[-->
            <main class="page" id="main-content"><!---->
                <nav class="breadcrumb">
                    <ol vocab="https://schema.org/" typeof="BreadcrumbList">
                        <li class="" property="itemListElement" typeof="ListItem"><a href="https://pro.autojs.org/docs/"
                                class="" property="item" typeof="WebPage"><span
                                    class="icon iconfont icon-home"></span><span property="name">Auto.js Pro</span></a>
                            <meta property="position" content="1">
                        </li>
                        <li class="" property="itemListElement" typeof="ListItem"><a
                                href="./" class="" property="item"
                                typeof="WebPage"><!----><span property="name">阅读须知</span></a>
                            <meta property="position" content="2">
                        </li>
                        <li class="is-active" property="itemListElement" typeof="ListItem"><a aria-current="page"
                                href="./images.html"
                                class="router-link-active router-link-exact-active" property="item"
                                typeof="WebPage"><!----><span property="name">images - 图片处理</span></a>
                            <meta property="position" content="3">
                        </li>
                    </ol>
                </nav>
                <div class="page-title">
                    <h1><!---->images - 图片处理</h1>
                    <div class="page-info"><span class="date-info" aria-label="写作日期📅" data-balloon-pos="down"><svg
                                xmlns="http://www.w3.org/2000/svg" class="icon calendar-icon" viewBox="0 0 1024 1024"
                                fill="currentColor" aria-label="calendar icon">
                                <path
                                    d="M716.4 110.137c0-18.753-14.72-33.473-33.472-33.473-18.753 0-33.473 14.72-33.473 33.473v33.473h66.993v-33.473zm-334.87 0c0-18.753-14.72-33.473-33.473-33.473s-33.52 14.72-33.52 33.473v33.473h66.993v-33.473zm468.81 33.52H716.4v100.465c0 18.753-14.72 33.473-33.472 33.473a33.145 33.145 0 01-33.473-33.473V143.657H381.53v100.465c0 18.753-14.72 33.473-33.473 33.473a33.145 33.145 0 01-33.473-33.473V143.657H180.6A134.314 134.314 0 0046.66 277.595v535.756A134.314 134.314 0 00180.6 947.289h669.74a134.36 134.36 0 00133.94-133.938V277.595a134.314 134.314 0 00-133.94-133.938zm33.473 267.877H147.126a33.145 33.145 0 01-33.473-33.473c0-18.752 14.72-33.473 33.473-33.473h736.687c18.752 0 33.472 14.72 33.472 33.473a33.145 33.145 0 01-33.472 33.473z">
                                </path>
                            </svg><span>2022年10月22日</span>
                            <meta property="datePublished" content="2022-10-22T07:36:15.000Z">
                        </span></div>
                    <hr>
                </div>
                <div class="toc-place-holder">
                    <aside id="toc">
                        <div class="toc-header">此页内容</div>
                        <div class="toc-wrapper">
                            <ul class="toc-list">
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#%E5%9B%BE%E7%89%87%E5%A4%84%E7%90%86"
                                        class="router-link-active router-link-exact-active toc-link level2">图片处理</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-read-path"
                                        class="router-link-active router-link-exact-active toc-link level2">images.read(path)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-load-url"
                                        class="router-link-active router-link-exact-active toc-link level2">images.load(url)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-copy-img"
                                        class="router-link-active router-link-exact-active toc-link level2">images.copy(img)</a>
                                </li><!---->
                                <li class="toc-item active"><a aria-current="page"
                                        href="./images.html#images-save-image-path-format-png-quality-100"
                                        class="router-link-active router-link-exact-active toc-link level2">images.save(image,
                                        path[, format = "png", quality = 100])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-frombase64-base64"
                                        class="router-link-active router-link-exact-active toc-link level2">images.fromBase64(base64)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-tobase64-img-format-png-quality-100"
                                        class="router-link-active router-link-exact-active toc-link level2">images.toBase64(img[,
                                        format = "png", quality = 100])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-frombytes-bytes"
                                        class="router-link-active router-link-exact-active toc-link level2">images.fromBytes(bytes)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-tobytes-img-format-png-quality-100"
                                        class="router-link-active router-link-exact-active toc-link level2">images.toBytes(img[,
                                        format = "png", quality = 100])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-readpixels-path"
                                        class="router-link-active router-link-exact-active toc-link level2">images.readPixels(path)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-clip-img-x-y-w-h"
                                        class="router-link-active router-link-exact-active toc-link level2">images.clip(img,
                                        x, y, w, h)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-resize-img-size-interpolation"
                                        class="router-link-active router-link-exact-active toc-link level2">images.resize(img,
                                        size[, interpolation])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-scale-img-fx-fy-interpolation"
                                        class="router-link-active router-link-exact-active toc-link level2">images.scale(img,
                                        fx, fy[, interpolation])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-rotate-img-degree-x-y"
                                        class="router-link-active router-link-exact-active toc-link level2">images.rotate(img,
                                        degree[, x, y])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-concat-img1-image2-direction"
                                        class="router-link-active router-link-exact-active toc-link level2">images.concat(img1,
                                        image2[, direction])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-grayscale-img"
                                        class="router-link-active router-link-exact-active toc-link level2">images.grayscale(img)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-threshold-img-threshold-maxval-type"
                                        class="router-link-active router-link-exact-active toc-link level2">images.threshold(img,
                                        threshold, maxVal[, type])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-adaptivethreshold-img-maxvalue-adaptivemethod-thresholdtype-blocksize-c"
                                        class="router-link-active router-link-exact-active toc-link level2">images.adaptiveThreshold(img,
                                        maxValue, adaptiveMethod, thresholdType, blockSize, C)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-cvtcolor-img-code-dstcn"
                                        class="router-link-active router-link-exact-active toc-link level2">images.cvtColor(img,
                                        code[, dstCn])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-inrange-img-lowerbound-upperbound"
                                        class="router-link-active router-link-exact-active toc-link level2">images.inRange(img,
                                        lowerBound, upperBound)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-interval-img-color-interval"
                                        class="router-link-active router-link-exact-active toc-link level2">images.interval(img,
                                        color, interval)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-blur-img-size-anchor-type"
                                        class="router-link-active router-link-exact-active toc-link level2">images.blur(img,
                                        size[, anchor, type])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-medianblur-img-size"
                                        class="router-link-active router-link-exact-active toc-link level2">images.medianBlur(img,
                                        size)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-gaussianblur-img-size-sigmax-sigmay-type"
                                        class="router-link-active router-link-exact-active toc-link level2">images.gaussianBlur(img,
                                        size[, sigmaX, sigmaY, type])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-getsimilarity-img1-img2-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.getSimilarity(img1,
                                        img2, options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-mattoimage-mat"
                                        class="router-link-active router-link-exact-active toc-link level2">images.matToImage(mat)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#%E6%89%BE%E5%9B%BE%E6%89%BE%E8%89%B2"
                                        class="router-link-active router-link-exact-active toc-link level2">找图找色</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-requestscreencapture-landscape"
                                        class="router-link-active router-link-exact-active toc-link level2">images.requestScreenCapture([landscape])</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-requestscreencapture-options"
                                        class="router-link-active router-link-exact-active toc-link level2">$images.requestScreenCapture(options)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-getscreencaptureoptions"
                                        class="router-link-active router-link-exact-active toc-link level2">$images.getScreenCaptureOptions()</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-stopscreencapture"
                                        class="router-link-active router-link-exact-active toc-link level2">$images.stopScreenCapture()</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-capturescreen"
                                        class="router-link-active router-link-exact-active toc-link level2">images.captureScreen()</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-capturescreen-path"
                                        class="router-link-active router-link-exact-active toc-link level2">images.captureScreen(path)</a>
                                </li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-pixel-image-x-y"
                                        class="router-link-active router-link-exact-active toc-link level2">images.pixel(image,
                                        x, y)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findcolor-image-color-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findColor(image,
                                        color, options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findcolorinregion-img-color-x-y-width-height-threshold"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findColorInRegion(img,
                                        color, x, y[, width, height, threshold])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findallpointsforcolor-img-color-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findAllPointsForColor(img,
                                        color, options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findcolorequals-img-color-x-y-width-height"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findColorEquals(img,
                                        color[, x, y, width, height])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findmulticolors-img-firstcolor-colors-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findMultiColors(img,
                                        firstColor, colors[, options])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-detectscolor-image-color-x-y-threshold-16-algorithm-diff"
                                        class="router-link-active router-link-exact-active toc-link level2">images.detectsColor(image,
                                        color, x, y[, threshold = 16, algorithm = "diff"])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-detectsmulticolors-img-x-y-firstcolor-colors-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.detectsMultiColors(img,
                                        x, y, firstColor, colors, options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findimage-img-template-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findImage(img,
                                        template[, options])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findimageinregion-img-template-x-y-width-height-threshold"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findImageInRegion(img,
                                        template, x, y[, width, height, threshold])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-matchtemplate-img-template-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.matchTemplate(img,
                                        template, options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-findcircles-gray-options"
                                        class="router-link-active router-link-exact-active toc-link level2">images.findCircles(gray,
                                        options)</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-detectandcomputefeatures-img-options"
                                        class="router-link-active router-link-exact-active toc-link level2">$images.detectAndComputeFeatures(img[,
                                        options]）</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#images-matchfeatures-scene-object-options"
                                        class="router-link-active router-link-exact-active toc-link level2">$images.matchFeatures(scene,
                                        object[, options])</a></li><!---->
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#imagefeatures"
                                        class="router-link-active router-link-exact-active toc-link level2">ImageFeatures</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#imagefeatures-recycle"
                                            class="router-link-active router-link-exact-active toc-link level3">ImageFeatures.recycle()</a>
                                    </li><!---->
                                </ul>
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#objectframe"
                                        class="router-link-active router-link-exact-active toc-link level2">ObjectFrame</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-topleft"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.topLeft</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-topright"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.topRight</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-bottomleft"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.bottomLeft</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-bottomright"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.bottomRight</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-center"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.center</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-centerx"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.centerX</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#objectframe-centery"
                                            class="router-link-active router-link-exact-active toc-link level3">ObjectFrame.centerY</a>
                                    </li><!---->
                                </ul>
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#matchingresult"
                                        class="router-link-active router-link-exact-active toc-link level2">MatchingResult</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-matches"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.matches</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-points"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.points</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-first"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.first()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-last"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.last()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-leftmost"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.leftmost()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-topmost"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.topmost()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-rightmost"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.rightmost()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-bottommost"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.bottommost()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-best"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.best()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-worst"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.worst()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#matchingresult-sortby-cmp"
                                            class="router-link-active router-link-exact-active toc-link level3">MatchingResult.sortBy(cmp)</a>
                                    </li><!---->
                                </ul>
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#image"
                                        class="router-link-active router-link-exact-active toc-link level2">Image</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#image-getwidth"
                                            class="router-link-active router-link-exact-active toc-link level3">Image.getWidth()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#image-getheight"
                                            class="router-link-active router-link-exact-active toc-link level3">Image.getHeight()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#image-saveto-path"
                                            class="router-link-active router-link-exact-active toc-link level3">Image.saveTo(path)</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#image-pixel-x-y"
                                            class="router-link-active router-link-exact-active toc-link level3">Image.pixel(x,
                                            y)</a></li><!---->
                                </ul>
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#point"
                                        class="router-link-active router-link-exact-active toc-link level2">Point</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#point-x"
                                            class="router-link-active router-link-exact-active toc-link level3">Point.x</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#point-y"
                                            class="router-link-active router-link-exact-active toc-link level3">Point.y</a>
                                    </li><!---->
                                </ul>
                                <li class="toc-item"><a aria-current="page"
                                        href="./images.html#colormapping"
                                        class="router-link-active router-link-exact-active toc-link level2">ColorMapping</a>
                                </li>
                                <ul class="toc-list">
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-singleton"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.singleton</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-reset-img"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.reset(img)</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-recycle"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.recycle()</a>
                                    </li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-findcolor-color-options"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.findColor(color[,
                                            options])</a></li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-findmulticolors-firstcolor-colors-options"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.findMultiColors(firstColor,
                                            colors, options)</a></li><!---->
                                    <li class="toc-item"><a aria-current="page"
                                            href="./images.html#colormapping-findallpointsforcolor-color-options"
                                            class="router-link-active router-link-exact-active toc-link level3">ColorMapping.findAllPointsForColor(color,
                                            options)</a></li><!---->
                                </ul>
                            </ul>
                        </div>
                    </aside>
                </div><!---->
                <div class="theme-hope-content">
                    <h1 id="images-图片处理" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-%E5%9B%BE%E7%89%87%E5%A4%84%E7%90%86"
                            aria-hidden="true">#</a> images - 图片处理</h1>
                    <blockquote>
                        <p>Stability: 2 - Stable</p>
                    </blockquote>
                    <p>images模块提供了一些手机设备中常见的图片处理函数，包括截图、读写图片、图片剪裁、旋转、二值化、找色找图等。</p>
                    <p>该模块分为两个部分，找图找色部分和图片处理部分。</p>
                    <p>需要注意的是，image对象创建后尽量在不使用时进行回收，同时避免循环创建大量图片。因为图片是一种占用内存比较大的资源，尽管Auto.js通过各种方式（比如图片缓存机制、垃圾回收时回收图片、脚本结束时回收所有图片）尽量降低图片资源的泄漏和内存占用，但是糟糕的代码仍然可以占用大量内存。
                    </p>
                    <p>Image对象通过调用<code><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>函数来回收。例如：
                    </p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 读取图片</span>
<span class="token keyword">var</span> img <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"./1.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 对图片进行操作</span>
<span class="token operator">...</span> 
<span class="token comment">// 回收图片</span>
img<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>例外的是，<code><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>返回的图片不需要回收。
                    </p>
                    <h2 id="图片处理" tabindex="-1"><a class="header-anchor"
                            href="./images.html#%E5%9B%BE%E7%89%87%E5%A4%84%E7%90%86"
                            aria-hidden="true">#</a> 图片处理</h2>
                    <h2 id="images-read-path" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-read-path"
                            aria-hidden="true">#</a> images.read(path)</h2>
                    <ul>
                        <li><code><span class="token property">path</span></code> {string} 图片路径</li>
                    </ul>
                    <p>读取在路径path的图片文件并返回一个Image对象。如果文件不存在或者文件无法解码则返回null。</p>
                    <h2 id="images-load-url" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-load-url"
                            aria-hidden="true">#</a> images.load(url)</h2>
                    <ul>
                        <li><code><span class="token property">url</span></code> {string} 图片URL地址</li>
                    </ul>
                    <p>加载在地址URL的网络图片并返回一个Image对象。如果地址不存在或者图片无法解码则返回null。</p>
                    <h2 id="images-copy-img" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-copy-img"
                            aria-hidden="true">#</a> images.copy(img)</h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>复制一张图片并返回新的副本。该函数会完全复制img对象的数据。</p>
                    <h2 id="images-save-image-path-format-png-quality-100" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-save-image-path-format-png-quality-100"
                            aria-hidden="true">#</a> images.save(image, path[, format = "png", quality = 100])</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {Image} 图片</li>
                        <li><code><span class="token property">path</span></code> {string} 路径</li>
                        <li><code><span class="token property">format</span></code> {string} 图片格式，可选的值为: <ul>
                                <li><code><span class="token property">png</span></code></li>
                                <li><code><span class="token property">jpeg</span></code>/<code><span class="token property">jpg</span></code>
                                </li>
                                <li><code><span class="token property">webp</span></code></li>
                            </ul>
                        </li>
                        <li><code><span class="token property">quality</span></code> {number} 图片质量，为0~100的整数值</li>
                    </ul>
                    <p>把图片image以PNG格式保存到path中。如果文件不存在会被创建；文件存在会被覆盖。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 把图片压缩为原来的一半质量并保存</span>
<span class="token keyword">var</span> img <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/1.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
images<span class="token punctuation">.</span><span class="token function">save</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"/sdcard/1.jpg"</span><span class="token punctuation">,</span> <span class="token string">"jpg"</span><span class="token punctuation">,</span> <span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
app<span class="token punctuation">.</span><span class="token function">viewFile</span><span class="token punctuation">(</span><span class="token string">"/sdcard/1.jpg"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-frombase64-base64" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-frombase64-base64"
                            aria-hidden="true">#</a> images.fromBase64(base64)</h2>
                    <ul>
                        <li><code><span class="token property">base64</span></code> {string} 图片的Base64数据</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>解码Base64数据并返回解码后的图片Image对象。如果base64无法解码则返回<code><span class="token keyword">null</span></code>。
                    </p>
                    <h2 id="images-tobase64-img-format-png-quality-100" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-tobase64-img-format-png-quality-100"
                            aria-hidden="true">#</a> images.toBase64(img[, format = "png", quality = 100])</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {image} 图片</li>
                        <li><code><span class="token property">format</span></code> {string} 图片格式，可选的值为: <ul>
                                <li><code><span class="token property">png</span></code></li>
                                <li><code><span class="token property">jpeg</span></code>/<code><span class="token property">jpg</span></code>
                                </li>
                                <li><code><span class="token property">webp</span></code></li>
                            </ul>
                        </li>
                        <li><code><span class="token property">quality</span></code> {number} 图片质量，为0~100的整数值</li>
                        <li>返回 {string}</li>
                    </ul>
                    <p>把图片编码为base64数据并返回。</p>
                    <h2 id="images-frombytes-bytes" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-frombytes-bytes"
                            aria-hidden="true">#</a> images.fromBytes(bytes)</h2>
                    <ul>
                        <li><code><span class="token property">bytes</span></code> {byte[]} 字节数组</li>
                    </ul>
                    <p>解码字节数组bytes并返回解码后的图片Image对象。如果bytes无法解码则返回<code><span class="token keyword">null</span></code>。
                    </p>
                    <h2 id="images-tobytes-img-format-png-quality-100" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-tobytes-img-format-png-quality-100"
                            aria-hidden="true">#</a> images.toBytes(img[, format = "png", quality = 100])</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {image} 图片</li>
                        <li><code><span class="token property">format</span></code> {string} 图片格式，可选的值为: <ul>
                                <li><code><span class="token property">png</span></code></li>
                                <li><code><span class="token property">jpeg</span></code>/<code><span class="token property">jpg</span></code>
                                </li>
                                <li><code><span class="token property">webp</span></code></li>
                            </ul>
                        </li>
                        <li><code><span class="token property">quality</span></code> {number} 图片质量，为0~100的整数值</li>
                        <li>返回 {byte[]}</li>
                    </ul>
                    <p>把图片编码为字节数组并返回。</p>
                    <h2 id="images-readpixels-path" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-readpixels-path"
                            aria-hidden="true">#</a> images.readPixels(path)</h2>
                    <ul>
                        <li><code><span class="token property">path</span></code> {string} 图片的地址</li>
                        <li>返回 {Object} 包括图片的像素数据和宽高，{data,width,height}</li>
                    </ul>
                    <p>读取图片的像素数据和宽高。</p>
                    <h2 id="images-clip-img-x-y-w-h" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-clip-img-x-y-w-h"
                            aria-hidden="true">#</a> images.clip(img, x, y, w, h)</h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">x</span></code> {number} 剪切区域的左上角横坐标</li>
                        <li><code><span class="token property">y</span></code> {number} 剪切区域的左上角纵坐标</li>
                        <li><code><span class="token property">w</span></code> {number} 剪切区域的宽度</li>
                        <li><code><span class="token property">h</span></code> {number} 剪切区域的高度</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>从图片img的位置(x, y)处剪切大小为w * h的区域，并返回该剪切区域的新图片。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token keyword">var</span> src <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/1.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> clip <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">clip</span><span class="token punctuation">(</span>src<span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">400</span><span class="token punctuation">,</span> <span class="token number">400</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
images<span class="token punctuation">.</span><span class="token function">save</span><span class="token punctuation">(</span>clip<span class="token punctuation">,</span> <span class="token string">"/sdcard/clip.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-resize-img-size-interpolation" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-resize-img-size-interpolation"
                            aria-hidden="true">#</a> images.resize(img, size[, interpolation])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li>
                            <p><code><span class="token property">img</span></code> {Image} 图片</p>
                        </li>
                        <li>
                            <p><code><span class="token property">size</span></code> {Array} 两个元素的数组[w,
                                h]，分别表示宽度和高度；如果只有一个元素，则宽度和高度相等</p>
                        </li>
                        <li>
                            <p><code><span class="token property">interpolation</span></code> {string}
                                插值方法，可选，默认为"LINEAR"（线性插值），可选的值有：</p>
                            <ul>
                                <li><code><span class="token constant">NEAREST</span></code> 最近邻插值</li>
                                <li><code><span class="token constant">LINEAR</span></code> 线性插值（默认）</li>
                                <li><code><span class="token constant">AREA</span></code> 区域插值</li>
                                <li><code><span class="token constant">CUBIC</span></code> 三次样条插值</li>
                                <li><code><span class="token constant">LANCZOS4</span></code> Lanczos插值 参见<a
                                        href="https://docs.opencv.org/3.4.4/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121"
                                        target="_blank" rel="noopener noreferrer">InterpolationFlags<span><svg
                                                class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                                aria-hidden="true" focusable="false" x="0px" y="0px"
                                                viewBox="0 0 100 100" width="15" height="15">
                                                <path fill="currentColor"
                                                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                                </path>
                                                <polygon fill="currentColor"
                                                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                                </polygon>
                                            </svg><span class="external-link-icon-sr-only">open in new
                                                window</span></span></a></li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {Image}</p>
                        </li>
                    </ul>
                    <p>调整图片大小，并返回调整后的图片。例如把图片放缩为200*300：<code>images<span class="token punctuation">.</span><span class="token function">resize</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">200</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">]</span><span class="token punctuation">)</span></code>。
                    </p>
                    <p>参见<a href="https://docs.opencv.org/3.4.4/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d"
                            target="_blank" rel="noopener noreferrer">Imgproc.resize<span><svg
                                    class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                                    focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-scale-img-fx-fy-interpolation" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-scale-img-fx-fy-interpolation"
                            aria-hidden="true">#</a> images.scale(img, fx, fy[, interpolation])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li>
                            <p><code><span class="token property">img</span></code> {Image} 图片</p>
                        </li>
                        <li>
                            <p><code><span class="token property">fx</span></code> {number} 宽度放缩倍数</p>
                        </li>
                        <li>
                            <p><code><span class="token property">fy</span></code> {number} 高度放缩倍数</p>
                        </li>
                        <li>
                            <p><code><span class="token property">interpolation</span></code> {string}
                                插值方法，可选，默认为"LINEAR"（线性插值），可选的值有：</p>
                            <ul>
                                <li><code><span class="token constant">NEAREST</span></code> 最近邻插值</li>
                                <li><code><span class="token constant">LINEAR</span></code> 线性插值（默认）</li>
                                <li><code><span class="token constant">AREA</span></code> 区域插值</li>
                                <li><code><span class="token constant">CUBIC</span></code> 三次样条插值</li>
                                <li><code><span class="token constant">LANCZOS4</span></code> Lanczos插值 参见<a
                                        href="https://docs.opencv.org/3.4.4/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121"
                                        target="_blank" rel="noopener noreferrer">InterpolationFlags<span><svg
                                                class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                                aria-hidden="true" focusable="false" x="0px" y="0px"
                                                viewBox="0 0 100 100" width="15" height="15">
                                                <path fill="currentColor"
                                                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                                </path>
                                                <polygon fill="currentColor"
                                                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                                </polygon>
                                            </svg><span class="external-link-icon-sr-only">open in new
                                                window</span></span></a></li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {Image}</p>
                        </li>
                    </ul>
                    <p>放缩图片，并返回放缩后的图片。例如把图片变成原来的一半：<code>images<span class="token punctuation">.</span><span class="token function">scale</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span></code>。
                    </p>
                    <p>参见<a href="https://docs.opencv.org/3.4.4/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d"
                            target="_blank" rel="noopener noreferrer">Imgproc.resize<span><svg
                                    class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                                    focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-rotate-img-degree-x-y" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-rotate-img-degree-x-y"
                            aria-hidden="true">#</a> images.rotate(img, degree[, x, y])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">degree</span></code> {number} 旋转角度。</li>
                        <li><code><span class="token property">x</span></code> {number} 旋转中心x坐标，默认为图片中点</li>
                        <li><code><span class="token property">y</span></code> {number} 旋转中心y坐标，默认为图片中点</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>将图片逆时针旋转degree度，返回旋转后的图片对象。</p>
                    <p>例如逆时针旋转90度为<code>images<span class="token punctuation">.</span><span class="token function">rotate</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token number">90</span><span class="token punctuation">)</span></code>。
                    </p>
                    <h2 id="images-concat-img1-image2-direction" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-concat-img1-image2-direction"
                            aria-hidden="true">#</a> images.concat(img1, image2[, direction])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img1</span></code> {Image} 图片1</li>
                        <li><code><span class="token property">img2</span></code> {Image} 图片2</li>
                        <li><code><span class="token property">direction</span></code> {string} 连接方向，默认为"RIGHT"，可选的值有：
                            <ul>
                                <li><code><span class="token constant">LEFT</span></code> 将图片2接到图片1左边</li>
                                <li><code><span class="token constant">RIGHT</span></code> 将图片2接到图片1右边</li>
                                <li><code><span class="token constant">TOP</span></code> 将图片2接到图片1上边</li>
                                <li><code><span class="token constant">BOTTOM</span></code> 将图片2接到图片1下边</li>
                            </ul>
                        </li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>连接两张图片，并返回连接后的图像。如果两张图片大小不一致，小的那张将适当居中。</p>
                    <h2 id="images-grayscale-img" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-grayscale-img"
                            aria-hidden="true">#</a> images.grayscale(img)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>灰度化图片，并返回灰度化后的图片。</p>
                    <h2 id="images-threshold-img-threshold-maxval-type" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-threshold-img-threshold-maxval-type"
                            aria-hidden="true">#</a> images.threshold(img, threshold, maxVal[, type])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li>
                            <p><code><span class="token property">img</span></code> {Image} 图片</p>
                        </li>
                        <li>
                            <p><code><span class="token property">threshold</span></code> {number} 阈值</p>
                        </li>
                        <li>
                            <p><code><span class="token property">maxVal</span></code> {number} 最大值</p>
                        </li>
                        <li>
                            <p><code><span class="token property">type</span></code> {string} 阈值化类型，默认为"BINARY"，参见<a
                                    href="https://docs.opencv.org/3.4.4/d7/d1b/group__imgproc__misc.html#gaa9e58d2860d4afa658ef70a9b1115576"
                                    target="_blank" rel="noopener noreferrer">ThresholdTypes<span><svg
                                            class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                            aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100"
                                            width="15" height="15">
                                            <path fill="currentColor"
                                                d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                            </path>
                                            <polygon fill="currentColor"
                                                points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                            </polygon>
                                        </svg><span class="external-link-icon-sr-only">open in new
                                            window</span></span></a>, 可选的值:</p>
                            <ul>
                                <li><code><span class="token constant">BINARY</span></code></li>
                                <li><code><span class="token constant">BINARY_INV</span></code></li>
                                <li><code><span class="token constant">TRUNC</span></code></li>
                                <li><code><span class="token constant">TOZERO</span></code></li>
                                <li><code><span class="token constant">TOZERO_INV</span></code></li>
                                <li><code><span class="token constant">OTSU</span></code></li>
                                <li><code><span class="token constant">TRIANGLE</span></code></li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {Image}</p>
                        </li>
                    </ul>
                    <p>将图片阈值化，并返回处理后的图像。可以用这个函数进行图片二值化。例如：<code>images<span class="token punctuation">.</span><span class="token function">threshold</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">255</span><span class="token punctuation">,</span> <span class="token string">"BINARY"</span><span class="token punctuation">)</span></code>，这个代码将图片中大于100的值全部变成255，其余变成0，从而达到二值化的效果。如果img是一张灰度化图片，这个代码将会得到一张黑白图片。
                    </p>
                    <p>可以参考有关博客（比如<a href="https://blog.csdn.net/u012566751/article/details/77046445" target="_blank"
                            rel="noopener noreferrer">threshold函数的使用<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d7/d1b/group__imgproc__misc.html#gae8a4a146d1ca78c626a53577199e9c57"
                            target="_blank" rel="noopener noreferrer">threshold<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-adaptivethreshold-img-maxvalue-adaptivemethod-thresholdtype-blocksize-c"
                        tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-adaptivethreshold-img-maxvalue-adaptivemethod-thresholdtype-blocksize-c"
                            aria-hidden="true">#</a> images.adaptiveThreshold(img, maxValue, adaptiveMethod,
                        thresholdType, blockSize, C)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">maxValue</span></code> {number} 最大值</li>
                        <li><code><span class="token property">adaptiveMethod</span></code> {string}
                            在一个邻域内计算阈值所采用的算法，可选的值有： <ul>
                                <li><code><span class="token constant">MEAN_C</span></code> 计算出领域的平均值再减去参数C的值</li>
                                <li><code><span class="token constant">GAUSSIAN_C</span></code> 计算出领域的高斯均值再减去参数C的值</li>
                            </ul>
                        </li>
                        <li><code><span class="token property">thresholdType</span></code> {string} 阈值化类型，可选的值有： <ul>
                                <li><code><span class="token constant">BINARY</span></code></li>
                                <li><code><span class="token constant">BINARY_INV</span></code></li>
                            </ul>
                        </li>
                        <li><code><span class="token property">blockSize</span></code> {number} 邻域块大小</li>
                        <li><code><span class="token constant">C</span></code> {number} 偏移值调整量</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>对图片进行自适应阈值化处理，并返回处理后的图像。</p>
                    <p>可以参考有关博客（比如<a href="https://blog.csdn.net/guduruyu/article/details/68059450" target="_blank"
                            rel="noopener noreferrer">threshold与adaptiveThreshold<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d7/d1b/group__imgproc__misc.html#ga72b913f352e4a1b1b397736707afcde3"
                            target="_blank" rel="noopener noreferrer">adaptiveThreshold<span><svg
                                    class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                                    focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-cvtcolor-img-code-dstcn" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-cvtcolor-img-code-dstcn"
                            aria-hidden="true">#</a> images.cvtColor(img, code[, dstCn])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">code</span></code> {string} 颜色空间转换的类型，可选的值有一共有205个（参见<a
                                href="https://docs.opencv.org/3.4.4/d8/d01/group__imgproc__color__conversions.html#ga4e0972be5de079fed4e3a10e24ef5ef0"
                                target="_blank" rel="noopener noreferrer">ColorConversionCodes<span><svg
                                        class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                                        focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                                        <path fill="currentColor"
                                            d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                        </path>
                                        <polygon fill="currentColor"
                                            points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                        </polygon>
                                    </svg><span class="external-link-icon-sr-only">open in new
                                        window</span></span></a>），这里只列出几个： <ul>
                                <li><code><span class="token constant">BGR2GRAY</span></code> BGR转换为灰度</li>
                                <li><code><span class="token constant">BGR2HSV</span></code> BGR转换为HSV</li>
                                <li>``</li>
                            </ul>
                        </li>
                        <li><code><span class="token property">dstCn</span></code> {number}
                            目标图像的颜色通道数量，如果不填写则根据其他参数自动决定。</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>对图像进行颜色空间转换，并返回转换后的图像。</p>
                    <p>可以参考有关博客（比如<a
                            href="https://blog.csdn.net/u011574296/article/details/70896811?locationNum=14&amp;fps=1"
                            target="_blank" rel="noopener noreferrer">颜色空间转换<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab"
                            target="_blank" rel="noopener noreferrer">cvtColor<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-inrange-img-lowerbound-upperbound" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-inrange-img-lowerbound-upperbound"
                            aria-hidden="true">#</a> images.inRange(img, lowerBound, upperBound)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">lowerBound</span></code> {string} | {number} 颜色下界</li>
                        <li><code><span class="token property">upperBound</span></code> {string} | {number} 颜色下界</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>将图片二值化，在lowerBound~upperBound范围以外的颜色都变成0，在范围以内的颜色都变成255。</p>
                    <p>例如<code>images<span class="token punctuation">.</span><span class="token function">inRange</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">,</span> <span class="token string">"#222222"</span><span class="token punctuation">)</span></code>。
                    </p>
                    <h2 id="images-interval-img-color-interval" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-interval-img-color-interval"
                            aria-hidden="true">#</a> images.interval(img, color, interval)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">color</span></code> {string} | {number} 颜色值</li>
                        <li><code><span class="token property">interval</span></code> {number} 每个通道的范围间隔</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>将图片二值化，在color-interval ~ color+interval范围以外的颜色都变成0，在范围以内的颜色都变成255。这里对color的加减是对每个通道而言的。</p>
                    <p>例如<code>images<span class="token punctuation">.</span><span class="token function">interval</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#888888"</span><span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">)</span></code>，每个通道的颜色值均为0x88，加减16后的范围是[0x78,
                        0x98]，因此这个代码将把#787878~#989898的颜色变成#FFFFFF，而把这个范围以外的变成#000000。</p>
                    <h2 id="images-blur-img-size-anchor-type" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-blur-img-size-anchor-type"
                            aria-hidden="true">#</a> images.blur(img, size[, anchor, type])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">size</span></code> {Array} 定义滤波器的大小，如[3, 3]</li>
                        <li><code><span class="token property">anchor</span></code> {Array} 指定锚点位置(被平滑点)，默认为图像中心</li>
                        <li><code><span class="token property">type</span></code> {string} 推断边缘像素类型，默认为"DEFAULT"，可选的值有：
                            <ul>
                                <li><code><span class="token constant">CONSTANT</span></code> iiiiii|abcdefgh|iiiiiii
                                    with some specified i</li>
                                <li><code><span class="token constant">REPLICATE</span></code> aaaaaa|abcdefgh|hhhhhhh
                                </li>
                                <li><code><span class="token constant">REFLECT</span></code> fedcba|abcdefgh|hgfedcb
                                </li>
                                <li><code><span class="token constant">WRAP</span></code> cdefgh|abcdefgh|abcdefg</li>
                                <li><code><span class="token constant">REFLECT_101</span></code> gfedcb|abcdefgh|gfedcba
                                </li>
                                <li><code><span class="token constant">TRANSPARENT</span></code> uvwxyz|abcdefgh|ijklmno
                                </li>
                                <li><code><span class="token constant">REFLECT101</span></code> same as
                                    BORDER_REFLECT_101</li>
                                <li><code><span class="token constant">DEFAULT</span></code> same as BORDER_REFLECT_101
                                </li>
                                <li><code><span class="token constant">ISOLATED</span></code> do not look outside of ROI
                                </li>
                            </ul>
                        </li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>对图像进行模糊（平滑处理），返回处理后的图像。</p>
                    <p>可以参考有关博客（比如<a href="https://www.cnblogs.com/denny402/p/3848316.html" target="_blank"
                            rel="noopener noreferrer">实现图像平滑处理<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d4/d86/group__imgproc__filter.html#ga8c45db9afe636703801b0b2e440fce37"
                            target="_blank" rel="noopener noreferrer">blur<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-medianblur-img-size" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-medianblur-img-size"
                            aria-hidden="true">#</a> images.medianBlur(img, size)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">size</span></code> {Array} 定义滤波器的大小，如[3, 3]</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>对图像进行中值滤波，返回处理后的图像。</p>
                    <p>可以参考有关博客（比如<a href="https://www.cnblogs.com/denny402/p/3848316.html" target="_blank"
                            rel="noopener noreferrer">实现图像平滑处理<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d4/d86/group__imgproc__filter.html#ga564869aa33e58769b4469101aac458f9"
                            target="_blank" rel="noopener noreferrer">blur<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-gaussianblur-img-size-sigmax-sigmay-type" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-gaussianblur-img-size-sigmax-sigmay-type"
                            aria-hidden="true">#</a> images.gaussianBlur(img, size[, sigmaX, sigmaY, type])</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">size</span></code> {Array} 定义滤波器的大小，如[3, 3]</li>
                        <li><code><span class="token property">sigmaX</span></code> {number} x方向的标准方差，不填写则自动计算</li>
                        <li><code><span class="token property">sigmaY</span></code> {number} y方向的标准方差，不填写则自动计算</li>
                        <li><code><span class="token property">type</span></code> {string}
                            推断边缘像素类型，默认为"DEFAULT"，参见<code>images<span class="token punctuation">.</span>blur</code></li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>对图像进行高斯模糊，返回处理后的图像。</p>
                    <p>可以参考有关博客（比如<a href="https://www.cnblogs.com/denny402/p/3848316.html" target="_blank"
                            rel="noopener noreferrer">实现图像平滑处理<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new
                                    window</span></span></a>）或者OpenCV文档<a
                            href="https://docs.opencv.org/3.4.4/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1"
                            target="_blank" rel="noopener noreferrer">GaussianBlur<span><svg class="external-link-icon"
                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px"
                                    y="0px" viewBox="0 0 100 100" width="15" height="15">
                                    <path fill="currentColor"
                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                    </path>
                                    <polygon fill="currentColor"
                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                    </polygon>
                                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a>。</p>
                    <h2 id="images-getsimilarity-img1-img2-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-getsimilarity-img1-img2-options"
                            aria-hidden="true">#</a> images.getSimilarity(img1, img2, options)</h2>
                    <ul>
                        <li>
                            <p><code><span class="token property">img1</span></code> {Image} 图片1</p>
                        </li>
                        <li>
                            <p><code><span class="token property">img2</span></code> {Image} 图片2</p>
                        </li>
                        <li>
                            <p><code><span class="token property">options</span></code> {Object} 选项包括：</p>
                            <ul>
                                <li><code><span class="token property">type</span></code> {string} 比较相似度的算法(默认为MSSIM)：
                                    <ul>
                                        <li><code><span class="token constant">MSSIM</span></code>
                                            平均结构相似性，在影像品质的衡量上更能符合人眼对影像品质的判断。结构相似性SSIM的取值范围是 [ 0 , 1 ]
                                            ，当两张图像越相似时，则SSIM越接近1。</li>
                                        <li><code><span class="token constant">PNSR</span></code>
                                            峰值信噪比，是针对于像素绝对误差，通过均方误差（MSE）进行定义，当两幅图像的PSNR小于30时，那么这两幅图像可以说是比较相似的。</li>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {number}</p>
                        </li>
                    </ul>
                    <p>比较两幅图片的相似性，返回相似度。</p>
                    <p>例如</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">log</span><span class="token punctuation">(</span>images<span class="token punctuation">.</span><span class="token function">getSimilarity</span><span class="token punctuation">(</span>img1<span class="token punctuation">,</span> img2<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token string-property property">"type"</span><span class="token operator">:</span> <span class="token string">"PNSR"</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-mattoimage-mat" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-mattoimage-mat"
                            aria-hidden="true">#</a> images.matToImage(mat)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">mat</span></code> {Mat} OpenCV的Mat对象</li>
                        <li>返回 {Image}</li>
                    </ul>
                    <p>把Mat对象转换为Image对象。</p>
                    <h2 id="找图找色" tabindex="-1"><a class="header-anchor"
                            href="./images.html#%E6%89%BE%E5%9B%BE%E6%89%BE%E8%89%B2"
                            aria-hidden="true">#</a> 找图找色</h2>
                    <p>找图找色介绍了通过截图、匹配等搜索目标的不同方式，可以根据实际情况选择不同的方式：</p>
                    <ul>
                        <li><a
                                href="./images.html#images-findcolor-image-color-options">找色、多点找色</a>：通过描述颜色或颜色路径匹配图片中的像素，效率较高
                        </li>
                        <li><a
                                href="./images.html#colormapping">基于ColorMaping的找色或多点找色</a>：适合每次截图都有多次找色、多点找色的情况，可以进一步提升找色效率，效率最高
                        </li>
                        <li><a
                                href="./images.html#images-findimage-img-template-options">找图（模板匹配）</a>：通过在大图中依次匹配小图，搜索小图的位置，效率中等，但不同分辨率兼容性较差
                        </li>
                        <li><a
                                href="./images.html#images-detectandcomputefeatures-img-options"><strong>全分辨率找图（特征匹配）</strong></a>：通过计算大图和小图的特征点，匹配特征而计算小图的位置，效率比普通找图低，但兼容分辨率、旋转等变化
                        </li>
                    </ul>
                    <h2 id="images-requestscreencapture-landscape" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-requestscreencapture-landscape"
                            aria-hidden="true">#</a> images.requestScreenCapture([landscape])</h2>
                    <ul>
                        <li><code><span class="token property">landscape</span></code> {boolean} 布尔值，
                            表示将要执行的截屏是否为横屏。如果landscape为false, 则表示竖屏截图; true为横屏截图。</li>
                    </ul>
                    <p>向系统申请屏幕截图权限，返回是否请求成功。</p>
                    <p>第一次使用该函数会弹出截图权限请求，建议选择“总是允许”。（某些系统没有总是允许选项）</p>
                    <p>这个函数只是申请截图权限，并不会真正执行截图，真正的截图函数是<code><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>。
                    </p>
                    <p>该函数在截图脚本中只需执行一次，而无需每次调用<code><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>都调用一次；若已有截图权限，则抛出异常。
                    </p>
                    <p><strong>如果不指定landscape值，则截图方向由当前设备屏幕方向决定</strong>，因此务必注意执行该函数时的屏幕</p>
                    <p>截图权限无法在脚本引擎之间共享。</p>
                    <p>建议在本软件界面运行该函数，在其他软件界面运行时容易出现一闪而过的黑屏现象；另外，<strong>某些定制ROM或者高版本Android不允许在后台弹出界面，在后台运行此函数时可能会一直阻塞</strong>。
                    </p>
                    <p>示例:</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 请求截图</span>
<span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"请求截图失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">exit</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">// 连续截图10张图片(间隔1秒)并保存到存储卡目录</span>
<span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">var</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">10</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token string">"/sdcard/screen_capture_"</span> <span class="token operator">+</span> i <span class="token operator">+</span> <span class="token string">".png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">sleep</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>该函数也可以作为全局函数使用。</p>
                    <h2 id="images-requestscreencapture-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-requestscreencapture-options"
                            aria-hidden="true">#</a> $images.requestScreenCapture(options)</h2>
                    <p><strong>[<a href="https://pro.autojs.org/" target="_blank" rel="noopener noreferrer">Pro
                                8.0新增<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                        aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100"
                                        width="15" height="15">
                                        <path fill="currentColor"
                                            d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                        </path>
                                        <polygon fill="currentColor"
                                            points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                        </polygon>
                                    </svg><span class="external-link-icon-sr-only">open in new
                                        window</span></span></a>]</strong></p>
                    <ul>
                        <li><code><span class="token property">options</span></code> {object} 申请截图选项 <ul>
                                <li><code><span class="token property">width</span></code> {number}
                                    截图宽度，默认为-1，即自动设置为设备屏幕宽度</li>
                                <li><code><span class="token property">height</span></code> {number}
                                    截图高度，默认为-1，即自动设置为设备屏幕高度</li>
                                <li><code><span class="token property">orientation</span></code> {number} 截图方向，默认为0 <ul>
                                        <li>-1：ORIENTATION_CURRENT, 检测当前的屏幕方向，用该方向作为申请截图的屏幕方向</li>
                                        <li>0: ORIENTATION_AUTO, 自动适应截图方向（转屏时自动切换方向）</li>
                                        <li>1: ORIENTATION_PORTRAIT， 竖屏截图</li>
                                        <li>2: ORIENTATION_LANDSCAPE, 横屏截图</li>
                                    </ul>
                                </li>
                                <li><code><span class="token keyword">async</span></code> {boolean} 是否为异步截图。默认为false
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <p>向系统申请屏幕截图权限，返回是否请求成功。对于width和height参数，系统只会匹配相邻的合适的宽高。截图宽高不一定和指定的宽高完全一致。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token literal-property property">orientation</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>更多参数和说明参见上面的<code>images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">[</span>landscape<span class="token punctuation">]</span><span class="token punctuation">)</span></code>函数，这里只特别解释<code><span class="token keyword">async</span></code>参数。
                    </p>
                    <p>当<code><span class="token keyword">async</span></code>为true时，申请截图将为异步截图，也即无法通过<code><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>来截图，而是通过事件<code><span class="token property">screen_capture</span></code>来监听截图。
                    </p>
                    <p>该事件将在屏幕变化时自动触发，对于屏幕刷新少的软件界面更加节能省电，对于游戏界面则可能无法达到省电效果。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 请求截图权限, 注意参数 async: true</span>
<span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token literal-property property">async</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">let</span> target <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">'./test.png'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
$events<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token string">'exit'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> target<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 监听屏幕截图</span>
$images<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token string">"screen_capture"</span><span class="token punctuation">,</span> <span class="token parameter">capture</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token comment">// 找图</span>
    <span class="token keyword">let</span> pos <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">findImage</span><span class="token punctuation">(</span>capture<span class="token punctuation">,</span> target<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">// 打印</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>pos<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-getscreencaptureoptions" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-getscreencaptureoptions"
                            aria-hidden="true">#</a> $images.getScreenCaptureOptions()</h2>
                    <p><strong>[<a href="https://pro.autojs.org/" target="_blank" rel="noopener noreferrer">Pro
                                8.8.12新增<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                        aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100"
                                        width="15" height="15">
                                        <path fill="currentColor"
                                            d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                        </path>
                                        <polygon fill="currentColor"
                                            points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                        </polygon>
                                    </svg><span class="external-link-icon-sr-only">open in new
                                        window</span></span></a>]</strong></p>
                    <ul>
                        <li>返回 {object} | {null}</li>
                    </ul>
                    <p>获取当前截图配置选项。如果并未申请截图权限，则返回<code><span class="token keyword">null</span></code>。返回的对象有以下字段： *
                        <code><span class="token property">width</span></code> {number} 截图宽度 *
                        <code><span class="token property">height</span></code> {number} 截图高度 *
                        <code><span class="token property">orientation</span></code> {number} 截图方向 * 0:
                        ORIENTATION_AUTO, 自动适应截图方向 * 1: ORIENTATION_PORTRAIT， 竖屏截图 * 2: ORIENTATION_LANDSCAPE, 横屏截图 *
                        <code><span class="token property">density</span></code> {number} 截图像素密度 *
                        <code><span class="token keyword">async</span></code> {boolean} 是否为异步截图</p>
                    <h2 id="images-stopscreencapture" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-stopscreencapture"
                            aria-hidden="true">#</a> $images.stopScreenCapture()</h2>
                    <p><strong>[<a href="https://pro.autojs.org/" target="_blank" rel="noopener noreferrer">Pro
                                8.8.12新增<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                        aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100"
                                        width="15" height="15">
                                        <path fill="currentColor"
                                            d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                        </path>
                                        <polygon fill="currentColor"
                                            points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                        </polygon>
                                    </svg><span class="external-link-icon-sr-only">open in new
                                        window</span></span></a>]</strong></p>
                    <p>释放截图权限。如果并未申请截图权限，则此函数没有任何作用。</p>
                    <h2 id="images-capturescreen" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-capturescreen"
                            aria-hidden="true">#</a> images.captureScreen()</h2>
                    <p>截取当前屏幕并返回一个Image对象。</p>
                    <p>没有截图权限时执行该函数会抛出SecurityException。</p>
                    <p>该函数不会返回null，两次调用可能返回相同的Image对象。这是因为设备截图的更新需要一定的时间，短时间内（一般来说是16ms）连续调用则会返回同一张截图。</p>
                    <p>截图需要转换为Bitmap格式，从而该函数执行需要一定的时间(0~20ms)。</p>
                    <p>另外在requestScreenCapture()执行成功后需要一定时间后才有截图可用，因此如果立即调用captureScreen()，会等待一定时间后(一般为几百ms)才返回截图。</p>
                    <p>例子:</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 请求横屏截图</span>
<span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截图</span>
<span class="token keyword">var</span> img <span class="token operator">=</span> <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取在点(100, 100)的颜色值</span>
<span class="token keyword">var</span> color <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">pixel</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 显示该颜色值</span>
<span class="token function">toast</span><span class="token punctuation">(</span>colors<span class="token punctuation">.</span><span class="token function">toString</span><span class="token punctuation">(</span>color<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>该函数也可以作为全局函数使用。</p>
                    <h2 id="images-capturescreen-path" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-capturescreen-path"
                            aria-hidden="true">#</a> images.captureScreen(path)</h2>
                    <ul>
                        <li><code><span class="token property">path</span></code> {string} 截图保存路径</li>
                    </ul>
                    <p>截取当前屏幕并以PNG格式保存到path中。如果文件不存在会被创建；文件存在会被覆盖。</p>
                    <p>该函数不会返回任何值。该函数也可以作为全局函数使用。</p>
                    <h2 id="images-pixel-image-x-y" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-pixel-image-x-y"
                            aria-hidden="true">#</a> images.pixel(image, x, y)</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {Image} 图片</li>
                        <li><code><span class="token property">x</span></code> {number} 要获取的像素的横坐标。</li>
                        <li><code><span class="token property">y</span></code> {number} 要获取的像素的纵坐标。</li>
                    </ul>
                    <p>返回图片image在点(x, y)处的像素的ARGB值。</p>
                    <p>该值的格式为0xAARRGGBB，是一个"32位整数"(虽然JavaScript中并不区分整数类型和其他数值类型)。</p>
                    <p>坐标系以图片左上角为原点。以图片左侧边为y轴，上侧边为x轴。</p>
                    <h2 id="images-findcolor-image-color-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findcolor-image-color-options"
                            aria-hidden="true">#</a> images.findColor(image, color, options)</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {Image} 图片</li>
                        <li><code><span class="token property">color</span></code> {number} | {string}
                            要寻找的颜色的RGB值。如果是一个整数，则以0xRRGGBB的形式代表RGB值（A通道会被忽略）；如果是字符串，则以"#RRGGBB"代表其RGB值。</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项</li>
                    </ul>
                    <p>在图片中寻找颜色color。找到时返回找到的点Point，找不到时返回null。</p>
                    <p>选项包括：</p>
                    <ul>
                        <li><code><span class="token property">region</span></code> {Array}
                            找色区域。是一个两个或四个元素的数组。(region[0],
                            region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                            region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                        <li><code><span class="token property">threshold</span></code> {number} 找色时颜色相似度的临界值，范围为0 ~
                            255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255 -
                            threshold) / 255.</li>
                    </ul>
                    <p>该函数也可以作为全局函数使用。</p>
                    <p>一个循环找色的例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// 循环找色，找到红色(#ff0000)时停止并报告坐标</span>
<span class="token keyword">while</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">var</span> img <span class="token operator">=</span> <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">var</span> point <span class="token operator">=</span> <span class="token function">findColor</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#ff0000"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>point<span class="token punctuation">)</span><span class="token punctuation">{</span>
        <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"找到红色，坐标为("</span> <span class="token operator">+</span> point<span class="token punctuation">.</span>x <span class="token operator">+</span> <span class="token string">", "</span> <span class="token operator">+</span> point<span class="token punctuation">.</span>y <span class="token operator">+</span> <span class="token string">")"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>一个区域找色的例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 读取本地图片/sdcard/1.png</span>
<span class="token keyword">var</span> img <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/1.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 判断图片是否加载成功</span>
<span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">!</span>img<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"没有该图片"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">exit</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">// 在该图片中找色，指定找色区域为在位置(400, 500)的宽为300长为200的区域，指定找色临界值为4</span>
<span class="token keyword">var</span> point <span class="token operator">=</span> <span class="token function">findColor</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#00ff00"</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
     <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">400</span><span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
     <span class="token literal-property property">threshold</span><span class="token operator">:</span> <span class="token number">4</span>
 <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>point<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"找到啦:"</span> <span class="token operator">+</span> point<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"没找到"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-findcolorinregion-img-color-x-y-width-height-threshold" tabindex="-1"><a
                            class="header-anchor"
                            href="./images.html#images-findcolorinregion-img-color-x-y-width-height-threshold"
                            aria-hidden="true">#</a> images.findColorInRegion(img, color, x, y[, width, height,
                        threshold])</h2>
                    <p>区域找色的简便方法。</p>
                    <p>相当于</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code>images<span class="token punctuation">.</span><span class="token function">findColor</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> color<span class="token punctuation">,</span> <span class="token punctuation">{</span>
     <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">,</span> width<span class="token punctuation">,</span> height<span class="token punctuation">]</span><span class="token punctuation">,</span>
     <span class="token literal-property property">threshold</span><span class="token operator">:</span> threshold
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>该函数也可以作为全局函数使用。</p>
                    <h2 id="images-findallpointsforcolor-img-color-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findallpointsforcolor-img-color-options"
                            aria-hidden="true">#</a> images.findAllPointsForColor(img, color, options)</h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">color</span></code> {number} | {string} 要检测的颜色</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                                <li><code><span class="token property">similarity</span></code> {number}
                                    找色时颜色相似度，范围为0~1（越大越相似，1为颜色相等，0为任何颜色都能匹配）。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    找色时颜色相似度的临界值，范围为0 ~
                                    255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255
                                    - threshold) / 255 。相似度与阈值二选一，同时存在则以相似度为准。</li>
                            </ul>
                        </li>
                        <li>返回 {Array}</li>
                    </ul>
                    <p>在图片中寻找所有颜色为color的点。找到时返回找到的点Point的数组，找不到时返回null。</p>
                    <p>例如找出所有白色的点：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">log</span><span class="token punctuation">(</span>images<span class="token punctuation">.</span><span class="token function">findAllPointsForColor</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#ffffff"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-findcolorequals-img-color-x-y-width-height" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findcolorequals-img-color-x-y-width-height"
                            aria-hidden="true">#</a> images.findColorEquals(img, color[, x, y, width, height])</h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 图片</li>
                        <li><code><span class="token property">color</span></code> {number} | {string} 要寻找的颜色</li>
                        <li><code><span class="token property">x</span></code> {number} 找色区域的左上角横坐标</li>
                        <li><code><span class="token property">y</span></code> {number} 找色区域的左上角纵坐标</li>
                        <li><code><span class="token property">width</span></code> {number} 找色区域的宽度</li>
                        <li><code><span class="token property">height</span></code> {number} 找色区域的高度</li>
                        <li>返回 {Point}</li>
                    </ul>
                    <p>在图片img指定区域中找到颜色和color完全相等的某个点，并返回该点的左边；如果没有找到，则返回<code><span class="token keyword">null</span></code>。
                    </p>
                    <p>找色区域通过<code><span class="token property">x</span></code>,
                        <code><span class="token property">y</span></code>,
                        <code><span class="token property">width</span></code>,
                        <code><span class="token property">height</span></code>指定，如果不指定找色区域，则在整张图片中寻找。</p>
                    <p>该函数也可以作为全局函数使用。</p>
                    <p>示例： (通过找QQ红点的颜色来判断是否有未读消息)</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">launchApp</span><span class="token punctuation">(</span><span class="token string">"QQ"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">sleep</span><span class="token punctuation">(</span><span class="token number">1200</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> p <span class="token operator">=</span> <span class="token function">findColorEquals</span><span class="token punctuation">(</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">"#f64d30"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"有未读消息"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"没有未读消息"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-findmulticolors-img-firstcolor-colors-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findmulticolors-img-firstcolor-colors-options"
                            aria-hidden="true">#</a> images.findMultiColors(img, firstColor, colors[, options])</h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 要找色的图片</li>
                        <li><code><span class="token property">firstColor</span></code> {number} | {string} 第一个点的颜色</li>
                        <li><code><span class="token property">colors</span></code> {Array}
                            表示剩下的点相对于第一个点的位置和颜色的数组，数组的每个元素为[x, y, color]</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项，包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    找色时颜色相似度的临界值，范围为0 ~
                                    255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255
                                    - threshold) / 255.</li>
                            </ul>
                        </li>
                    </ul>
                    <p>多点找色，类似于按键精灵的多点找色，其过程如下：</p>
                    <ol>
                        <li>在图片img中找到颜色firstColor的位置(x0, y0)</li>
                        <li>对于数组colors的每个元素[x, y, color]，检查图片img在位置(x + x0, y + y0)上的像素是否是颜色color，是的话返回(x0,
                            y0)，否则继续寻找firstColor的位置，重新执行第1步</li>
                        <li>整张图片都找不到时返回<code><span class="token keyword">null</span></code></li>
                    </ol>
                    <p>例如，对于代码<code>images<span class="token punctuation">.</span><span class="token function">findMultiColors</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#123456"</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token string">"#ffffff"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">40</span><span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span></code>，假设图片在(100,
                        200)的位置的颜色为#123456, 这时如果(110, 220)的位置的颜色为#fffff且(130, 240)的位置的颜色为#000000，则函数返回点(100, 200)。</p>
                    <p>如果要指定找色区域，则在options中指定，例如:</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token keyword">var</span> p <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">findMultiColors</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#123456"</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token string">"#ffffff"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">40</span><span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">960</span><span class="token punctuation">,</span> <span class="token number">1080</span><span class="token punctuation">,</span> <span class="token number">960</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-detectscolor-image-color-x-y-threshold-16-algorithm-diff" tabindex="-1"><a
                            class="header-anchor"
                            href="./images.html#images-detectscolor-image-color-x-y-threshold-16-algorithm-diff"
                            aria-hidden="true">#</a> images.detectsColor(image, color, x, y[, threshold = 16, algorithm
                        = "diff"])</h2>
                    <ul>
                        <li><code><span class="token property">image</span></code> {Image} 图片</li>
                        <li><code><span class="token property">color</span></code> {number} | {string} 要检测的颜色</li>
                        <li><code><span class="token property">x</span></code> {number} 要检测的位置横坐标</li>
                        <li><code><span class="token property">y</span></code> {number} 要检测的位置纵坐标</li>
                        <li><code><span class="token property">threshold</span></code> {number} 颜色相似度临界值，默认为16。取值范围为0 ~
                            255。</li>
                        <li><code><span class="token property">algorithm</span></code> {string} 颜色匹配算法，包括: <ul>
                                <li>
                                    <p>"equal": 相等匹配，只有与给定颜色color完全相等时才匹配。</p>
                                </li>
                                <li>
                                    <p>"diff": 差值匹配。与给定颜色的R、G、B差的绝对值之和小于threshold时匹配。</p>
                                </li>
                                <li>
                                    <p>"rgb": rgb欧拉距离相似度。与给定颜色color的rgb欧拉距离小于等于threshold时匹配。</p>
                                </li>
                                <li>
                                    <p>"rgb+": 加权rgb欧拉距离匹配(<a href="https://en.wikipedia.org/wiki/Color_difference"
                                            target="_blank" rel="noopener noreferrer">LAB Delta E<span><svg
                                                    class="external-link-icon" xmlns="http://www.w3.org/2000/svg"
                                                    aria-hidden="true" focusable="false" x="0px" y="0px"
                                                    viewBox="0 0 100 100" width="15" height="15">
                                                    <path fill="currentColor"
                                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                                    </path>
                                                    <polygon fill="currentColor"
                                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                                    </polygon>
                                                </svg><span class="external-link-icon-sr-only">open in new
                                                    window</span></span></a>)。</p>
                                </li>
                                <li>
                                    <p>"hs": hs欧拉距离匹配。hs为HSV空间的色调值。</p>
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <p>返回图片image在位置(x, y)处是否匹配到颜色color。用于检测图片中某个位置是否是特定颜色。</p>
                    <p>一个判断微博客户端的某个微博是否被点赞过的例子：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 找到点赞控件</span>
<span class="token keyword">var</span> like <span class="token operator">=</span> <span class="token function">id</span><span class="token punctuation">(</span><span class="token string">"ly_feed_like_icon"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">findOne</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取该控件中点坐标</span>
<span class="token keyword">var</span> x <span class="token operator">=</span> like<span class="token punctuation">.</span><span class="token function">bounds</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">centerX</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> y <span class="token operator">=</span> like<span class="token punctuation">.</span><span class="token function">bounds</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">centerY</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截图</span>
<span class="token keyword">var</span> img <span class="token operator">=</span> <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 判断在该坐标的颜色是否为橙红色</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>images<span class="token punctuation">.</span><span class="token function">detectsColor</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token string">"#fed9a8"</span><span class="token punctuation">,</span> x<span class="token punctuation">,</span> y<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token comment">// 是的话则已经是点赞过的了，不做任何动作</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token comment">// 否则点击点赞按钮</span>
    like<span class="token punctuation">.</span><span class="token function">click</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-detectsmulticolors-img-x-y-firstcolor-colors-options" tabindex="-1"><a
                            class="header-anchor"
                            href="./images.html#images-detectsmulticolors-img-x-y-firstcolor-colors-options"
                            aria-hidden="true">#</a> images.detectsMultiColors(img, x, y, firstColor, colors, options)
                    </h2>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 目标图片</li>
                        <li><code><span class="token property">x</span></code> {number} 第一个点的x坐标</li>
                        <li><code><span class="token property">y</span></code> {number} 第一个点的y坐标</li>
                        <li><code><span class="token property">firstColor</span></code> {number} | {string} 第一个点的颜色</li>
                        <li><code><span class="token property">colors</span></code> {Array}
                            表示剩下的点相对于第一个点的位置和颜色的数组，数组的每个元素为[x, y, color]</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项，包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则区域为整张图片。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    比色时颜色相似度的临界值，范围为0 ~
                                    255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255
                                    - threshold) / 255.</li>
                            </ul>
                        </li>
                        <li>返回 <code><span class="token property">boolean</span></code></li>
                    </ul>
                    <p>多点比色，返回img在起始位置(x, y)处的多个点的颜色是否匹配。</p>
                    <p>参见<code>images<span class="token punctuation">.</span><span class="token function">findMultiColors</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>多点找色的文档。
                    </p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">log</span><span class="token punctuation">(</span>images<span class="token punctuation">.</span><span class="token function">detectsMultiColors</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">"#123456"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">"#ff0000"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-findimage-img-template-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findimage-img-template-options"
                            aria-hidden="true">#</a> images.findImage(img, template[, options])</h2>
                    <p><strong>[v8.5.5新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 大图片</li>
                        <li><code><span class="token property">template</span></code> {Image} 小图片（模板）</li>
                        <li><code><span class="token property">options</span></code> {Object} 找图选项</li>
                    </ul>
                    <p>找图。在大图片img中查找小图片template的位置（模块匹配），找到时返回位置坐标(Point)，找不到时返回null。</p>
                    <p>选项包括：</p>
                    <ul>
                        <li><code><span class="token property">threshold</span></code> {number}
                            图片相似度。取值范围为0~1的浮点数。默认值为0.9。</li>
                        <li><code><span class="token property">region</span></code> {Array}
                            找图区域。参见findColor函数关于region的说明。</li>
                        <li><code><span class="token property">level</span></code> {number}
                            <strong>一般而言不必修改此参数</strong>。不加此参数时该参数会根据图片大小自动调整。找图算法是采用图像金字塔进行的, level参数表示金字塔的层次,
                            level越大可能带来越高的找图效率，但也可能造成找图失败（图片因过度缩小而无法分辨）或返回错误位置。因此，除非您清楚该参数的意义并需要进行性能调优，否则不需要用到该参数。</li>
                    </ul>
                    <p>该函数也可以作为全局函数使用。</p>
                    <p>一个最简单的找图例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token keyword">var</span> img <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/大图.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> templ <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/小图.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> p <span class="token operator">=</span> <span class="token function">findImage</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> templ<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"找到啦:"</span> <span class="token operator">+</span> p<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"没找到"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>稍微复杂点的区域找图例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token function">auto</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> wx <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">"/sdcard/微信图标.png"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 返回桌面</span>
<span class="token function">home</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截图并找图</span>
<span class="token keyword">var</span> p <span class="token operator">=</span> <span class="token function">findImage</span><span class="token punctuation">(</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> wx<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">50</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token literal-property property">threshold</span><span class="token operator">:</span> <span class="token number">0.8</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"在桌面找到了微信图标啦: "</span> <span class="token operator">+</span> p<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"在桌面没有找到微信图标"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-findimageinregion-img-template-x-y-width-height-threshold" tabindex="-1"><a
                            class="header-anchor"
                            href="./images.html#images-findimageinregion-img-template-x-y-width-height-threshold"
                            aria-hidden="true">#</a> images.findImageInRegion(img, template, x, y[, width, height,
                        threshold])</h2>
                    <p>区域找图的简便方法。相当于：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code>images<span class="token punctuation">.</span><span class="token function">findImage</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> template<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">,</span> width<span class="token punctuation">,</span> height<span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token literal-property property">threshold</span><span class="token operator">:</span> threshold
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>该函数也可以作为全局函数使用。</p>
                    <h2 id="images-matchtemplate-img-template-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-matchtemplate-img-template-options"
                            aria-hidden="true">#</a> images.matchTemplate(img, template, options)</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 大图片</li>
                        <li><code><span class="token property">template</span></code> {Image} 小图片（模板）</li>
                        <li><code><span class="token property">options</span></code> {Object} 找图选项： <ul>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    图片相似度。取值范围为0~1的浮点数。默认值为0.9。</li>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找图区域。参见findColor函数关于region的说明。</li>
                                <li><code><span class="token property">max</span></code> {number} 找图结果最大数量，默认为5</li>
                                <li><code><span class="token property">transparentMask</span></code> {boolean}
                                    是否使用透明模板找图。此选项开启后，传入的template参数可以是一个透明背景的图片对象用于匹配。此选项为 <strong>[<a
                                            href="https://pro.autojs.org/" target="_blank" rel="noopener noreferrer">Pro
                                            8.0新增<span><svg class="external-link-icon"
                                                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                                                    focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15"
                                                    height="15">
                                                    <path fill="currentColor"
                                                        d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                                                    </path>
                                                    <polygon fill="currentColor"
                                                        points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                                                    </polygon>
                                                </svg><span class="external-link-icon-sr-only">open in new
                                                    window</span></span></a>]</strong> 。</li>
                                <li><code><span class="token property">level</span></code> {number}
                                    <strong>一般而言不必修改此参数</strong>。不加此参数时该参数会根据图片大小自动调整。找图算法是采用图像金字塔进行的, level参数表示金字塔的层次,
                                    level越大可能带来越高的找图效率，但也可能造成找图失败（图片因过度缩小而无法分辨）或返回错误位置。因此，除非您清楚该参数的意义并需要进行性能调优，否则不需要用到该参数。
                                </li>
                            </ul>
                        </li>
                        <li>返回 {MatchingResult}</li>
                    </ul>
                    <p>在大图片中搜索小图片，并返回搜索结果MatchingResult。该函数可以用于找图时找出多个位置，可以通过max参数控制最大的结果数量。也可以对匹配结果进行排序、求最值等操作。</p>
                    <h2 id="images-findcircles-gray-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-findcircles-gray-options"
                            aria-hidden="true">#</a> images.findCircles(gray, options)</h2>
                    <ul>
                        <li>
                            <p><code><span class="token property">gray</span></code> {Image} 灰度图片</p>
                        </li>
                        <li>
                            <p><code><span class="token property">options</span></code> {Object} 选项包括：</p>
                            <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找圆区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找圆区域的左上角；region[2]*region[3]表示找圆区域的宽高。如果只有region只有两个元素，则找圆区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找圆区域为整张图片。</li>
                                <li><code><span class="token property">dp</span></code> {number}
                                    dp是累加面与原始图像相比的分辨率的反比参数，dp=2时累计面分辨率是元素图像的一半，宽高都缩减为原来的一半，dp=1时，两者相同。默认为1。</li>
                                <li><code><span class="token property">minDst</span></code> {number}
                                    minDist定义了两个圆心之间的最小距离。默认为图片高度的八分之一。</li>
                                <li><code><span class="token property">param1</span></code> {number}
                                    param1是Canny边缘检测的高阈值，低阈值被自动置为高阈值的一半。默认为100，范围为0-255。</li>
                                <li><code><span class="token property">param2</span></code> {number}
                                    param2是累加平面对是否是圆的判定阈值，默认为100。</li>
                                <li><code><span class="token property">minRadius</span></code> {number}
                                    定义了检测到的圆的半径的最小值，默认为0。</li>
                                <li><code><span class="token property">maxRadius</span></code> {number}
                                    定义了检测到的圆的半径的最大值，0为不限制最大值，默认为0。</li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {Array}</p>
                        </li>
                    </ul>
                    <p>在图片中寻找圆（做霍夫圆变换）。找到时返回找到的所有圆{x,y,radius}的数组，找不到时返回null。</p>
                    <p>一个寻找圆的例子：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 请求截图</span>
<span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截图</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 灰度化图片</span>
<span class="token keyword">let</span> gray <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">grayscale</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 找圆</span>
<span class="token keyword">let</span> arr <span class="token operator">=</span> <span class="token function">findCircles</span><span class="token punctuation">(</span>gray<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">dp</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
    <span class="token literal-property property">minDst</span><span class="token operator">:</span> <span class="token number">80</span><span class="token punctuation">,</span>
    <span class="token literal-property property">param1</span><span class="token operator">:</span> <span class="token number">100</span><span class="token punctuation">,</span>
    <span class="token literal-property property">param2</span><span class="token operator">:</span> <span class="token number">100</span><span class="token punctuation">,</span>
    <span class="token literal-property property">minRadius</span><span class="token operator">:</span> <span class="token number">50</span><span class="token punctuation">,</span>
    <span class="token literal-property property">maxRadius</span><span class="token operator">:</span> <span class="token number">80</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 回收图片</span>
gray<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="images-detectandcomputefeatures-img-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-detectandcomputefeatures-img-options"
                            aria-hidden="true">#</a> $images.detectAndComputeFeatures(img[, options]）</h2>
                    <p><strong>[v9.2新增]</strong></p>
                    <ul>
                        <li>
                            <p><code><span class="token property">img</span></code> {Image} 图片，要计算特征的图片</p>
                        </li>
                        <li>
                            <p><code><span class="token property">options</span></code> {object} 特征计算选项，可选参数：</p>
                            <ul>
                                <li><code><span class="token property">scale</span></code> {number}
                                    计算特征时图片的缩放比例，缩放比例越小，计算特征越快，但可能因为放缩过度导致特征计算错误。对于宽度 * 高度 &gt;
                                    1000000的图片，scale参数默认为0.5，否则scale默认为1</li>
                                <li><code><span class="token property">grayscale</span></code> {boolean}
                                    是否灰度化后再计算特征，默认为<code><span class="token boolean">true</span></code></li>
                                <li><code><span class="token property">method</span></code> {string}
                                    图像特征匹配的方法，默认为<code><span class="token constant">SIFT</span></code>，也可指定为<code><span class="token constant">ORB</span></code>（不推荐）
                                </li>
                                <li><code><span class="token property">region</span></code> {Array}
                                    图像的匹配区域，不填此字段时则为整个图片计算特征</li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {<a
                                    href="./images.html#imagefeatures">ImageFeatures</a>}
                                保存图片特征的对象，不用时需要调用<code><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>回收
                            </p>
                        </li>
                    </ul>
                    <p>对给定图片计算特征，将图片计算后的特征信息返回。该特征信息对象可用于后续使用<a
                            href="./images.html#images-matchfeatures-scene-object-options">matchFeatures</a>函数做特征匹配。
                    </p>
                    <p>一般而言，小图的特征可以在程序开始时就计算，在程序结束时再回收。如果每次截图时都去读取小图、计算小图特征，不仅会导致程序运行效率低，而且会导致内存碎片，从而使得内存难以利用和更快耗尽。</p>
                    <h2 id="images-matchfeatures-scene-object-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#images-matchfeatures-scene-object-options"
                            aria-hidden="true">#</a> $images.matchFeatures(scene, object[, options])</h2>
                    <p><strong>[v9.2新增]</strong></p>
                    <ul>
                        <li>
                            <p><code><span class="token property">scene</span></code> {ImageFeatures} 场景图片的特征对象（大图特征）
                            </p>
                        </li>
                        <li>
                            <p><code><span class="token property">object</span></code> {ImageFeatures} 目标图片的特征对象（小图特征）
                            </p>
                        </li>
                        <li>
                            <p><code><span class="token property">options</span></code> {object} 可选参数：</p>
                            <ul>
                                <li><code><span class="token property">matcher</span></code> {string}
                                    特征匹配方式，默认为<code><span class="token constant">FLANNBASED</span></code>，可选的值有<code><span class="token string">"FLANNBASED"</span></code>,
                                    <code><span class="token string">"BRUTEFORCE"</span></code>,
                                    <code><span class="token string">"BRUTEFORCE_L1"</span></code>,
                                    <code><span class="token string">"BRUTEFORCE_HAMMING"</span></code>,
                                    <code><span class="token string">"BRUTEFORCE_HAMMINGLUT"</span></code>,
                                    <code><span class="token string">"BRUTEFORCE_SL2"</span></code>，除了<code><span class="token constant">FLANNBASED</span></code>外其他匹配方式未经过充分测试
                                </li>
                                <li><code><span class="token property">drawMatches</span></code> {string}
                                    绘制图片匹配详情的路径，若为空则不绘制匹配详情。此选项一般为调试使用，在真正匹配时请勿指定，否则会增加耗时。</li>
                                <li><code><span class="token property">thredshold</span></code> {number}
                                    匹配阈值，默认为<code><span class="token number">0.7</span></code></li>
                            </ul>
                        </li>
                        <li>
                            <p>返回 {<a href="./images.html#objectframe">ObjectFrame</a>}
                                | {null} 小图在大图中的匹配位置，若未找到则返回<code><span class="token keyword">null</span></code></p>
                        </li>
                    </ul>
                    <p>特征匹配提供了全分辨率找图功能，可以识别检测图像中明显的特征并根据特征来查找类似图片。即使图片的分辨率、形状、旋转有差异也能识别出来，但匹配速度相对较慢。</p>
                    <p>需要注意的是，计算特征的过程也比较耗时，因此请勿在每次匹配时才计算小图的特征，小图若不变可以提前计算特征并复用特征对象。</p>
                    <p>以下是一个简单的示例，也在Auto.js Pro内置示例"图片与图色处理 - 找图找色"文件夹中，可直接运行。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 读取小图</span>
<span class="token keyword">let</span> hellokitty <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span><span class="token string">'./hellokitty.jpg'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 计算小图特征</span>
<span class="token keyword">let</span> objectFeatures <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">detectAndComputeFeatures</span><span class="token punctuation">(</span>hellokitty<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 请求截图权限</span>
<span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// 打开HelloKitty图片</span>
$app<span class="token punctuation">.</span><span class="token function">openUrl</span><span class="token punctuation">(</span><span class="token string">'https://baike.baidu.com/item/Hello%20Kitty/984270'</span><span class="token punctuation">)</span>

<span class="token keyword">let</span> n <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> n<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token function">sleep</span><span class="token punctuation">(</span><span class="token number">3000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">let</span> capture <span class="token operator">=</span> <span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">// 若要提高效率，可以在计算大图特征时调整scale参数，默认为0.5，</span>
    <span class="token comment">// 越小越快，但可以放缩过度导致匹配错误。若在特征匹配时无法搜索到正确结果，可以调整这里的参数，比如{scale: 1}</span>
    <span class="token comment">// 也可以在这里指定{region: [...]}参数只计算这个区域的特征提高效率</span>
    <span class="token keyword">let</span> sceneFeatures <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">detectAndComputeFeatures</span><span class="token punctuation">(</span>capture<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">// 最后一次匹配时，我们将特征和匹配绘制出来，在调试时更容易看出匹配效果，但会增加耗时</span>
    <span class="token keyword">let</span> drawMatches <span class="token operator">=</span> <span class="token punctuation">(</span>i <span class="token operator">===</span> n <span class="token operator">-</span> <span class="token number">1</span> <span class="token operator">?</span> <span class="token string">'./matches.jpg'</span> <span class="token operator">:</span> <span class="token keyword">undefined</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">let</span> result <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">matchFeatures</span><span class="token punctuation">(</span>sceneFeatures<span class="token punctuation">,</span> objectFeatures<span class="token punctuation">,</span> <span class="token punctuation">{</span> drawMatches <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">// 打印结果和中心点，可使用click(reuslt.centerX, result.centerY)点击</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>result<span class="token punctuation">,</span> result <span class="token operator">?</span> result<span class="token punctuation">.</span>center <span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">// 回收特征对象</span>
    sceneFeatures<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>drawMatches<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">// 可以在当前目录查看matches.jpg图片，会绘制详细匹配详情</span>
        app<span class="token punctuation">.</span><span class="token function">viewFile</span><span class="token punctuation">(</span><span class="token string">'./matches.jpg'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token comment">// 回收小图特征对象</span>
objectFeatures<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
hellokitty<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="imagefeatures" tabindex="-1"><a class="header-anchor"
                            href="./images.html#imagefeatures" aria-hidden="true">#</a>
                        ImageFeatures</h2>
                    <p><strong>[v9.2新增]</strong></p>
                    <p>存储特征信息的类，仅用于特征匹配。</p>
                    <h3 id="imagefeatures-recycle" tabindex="-1"><a class="header-anchor"
                            href="./images.html#imagefeatures-recycle"
                            aria-hidden="true">#</a> ImageFeatures.recycle()</h3>
                    <p>回收特征对象。必须显式在不使用该对象时调用，否则会导致内存泄露而程序崩溃。</p>
                    <h2 id="objectframe" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe" aria-hidden="true">#</a>
                        ObjectFrame</h2>
                    <p><strong>[v9.2新增]</strong></p>
                    <p>特征匹配返回的结果，表示一个四边形。</p>
                    <h3 id="objectframe-topleft" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-topleft"
                            aria-hidden="true">#</a> ObjectFrame.topLeft</h3>
                    <ul>
                        <li>{<a href="./images.html#point">Point</a>}</li>
                    </ul>
                    <p>四边形的左上角坐标。</p>
                    <h3 id="objectframe-topright" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-topright"
                            aria-hidden="true">#</a> ObjectFrame.topRight</h3>
                    <ul>
                        <li>{<a href="./images.html#point">Point</a>}</li>
                    </ul>
                    <p>四边形的右上角坐标。</p>
                    <h3 id="objectframe-bottomleft" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-bottomleft"
                            aria-hidden="true">#</a> ObjectFrame.bottomLeft</h3>
                    <ul>
                        <li>{<a href="./images.html#point">Point</a>}</li>
                    </ul>
                    <p>四边形的左下角坐标。</p>
                    <h3 id="objectframe-bottomright" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-bottomright"
                            aria-hidden="true">#</a> ObjectFrame.bottomRight</h3>
                    <ul>
                        <li>{<a href="./images.html#point">Point</a>}</li>
                    </ul>
                    <p>四边形的右下角坐标。</p>
                    <h3 id="objectframe-center" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-center"
                            aria-hidden="true">#</a> ObjectFrame.center</h3>
                    <ul>
                        <li>{<a href="./images.html#point">Point</a>}</li>
                    </ul>
                    <p>四边形的中心点坐标。</p>
                    <h3 id="objectframe-centerx" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-centerx"
                            aria-hidden="true">#</a> ObjectFrame.centerX</h3>
                    <ul>
                        <li>{number}</li>
                    </ul>
                    <p>四边形的中心点x坐标。</p>
                    <h3 id="objectframe-centery" tabindex="-1"><a class="header-anchor"
                            href="./images.html#objectframe-centery"
                            aria-hidden="true">#</a> ObjectFrame.centerY</h3>
                    <ul>
                        <li>{number}</li>
                    </ul>
                    <p>四边形的中心点y坐标。</p>
                    <h2 id="matchingresult" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult" aria-hidden="true">#</a>
                        MatchingResult</h2>
                    <p><strong>[v4.1.0新增]</strong></p>
                    <h3 id="matchingresult-matches" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-matches"
                            aria-hidden="true">#</a> MatchingResult.matches</h3>
                    <ul>
                        <li>{Array} 匹配结果的数组。</li>
                    </ul>
                    <p>数组的元素是一个Match对象：</p>
                    <ul>
                        <li><code><span class="token property">point</span></code> {Point} 匹配位置</li>
                        <li><code><span class="token property">similarity</span></code> {number} 相似度</li>
                    </ul>
                    <p>例如:</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token keyword">var</span> result <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">matchTemplate</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> template<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">max</span><span class="token operator">:</span> <span class="token number">100</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
result<span class="token punctuation">.</span>matches<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">match</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    <span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"point = "</span> <span class="token operator">+</span> match<span class="token punctuation">.</span>point <span class="token operator">+</span> <span class="token string">", similarity = "</span> <span class="token operator">+</span> match<span class="token punctuation">.</span>similarity<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h3 id="matchingresult-points" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-points"
                            aria-hidden="true">#</a> MatchingResult.points</h3>
                    <ul>
                        <li>{Array} 匹配位置的数组。</li>
                    </ul>
                    <h3 id="matchingresult-first" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-first"
                            aria-hidden="true">#</a> MatchingResult.first()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>第一个匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-last" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-last"
                            aria-hidden="true">#</a> MatchingResult.last()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>最后一个匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-leftmost" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-leftmost"
                            aria-hidden="true">#</a> MatchingResult.leftmost()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>位于大图片最左边的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-topmost" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-topmost"
                            aria-hidden="true">#</a> MatchingResult.topmost()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>位于大图片最上边的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-rightmost" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-rightmost"
                            aria-hidden="true">#</a> MatchingResult.rightmost()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>位于大图片最右边的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-bottommost" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-bottommost"
                            aria-hidden="true">#</a> MatchingResult.bottommost()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>位于大图片最下边的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-best" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-best"
                            aria-hidden="true">#</a> MatchingResult.best()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>相似度最高的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-worst" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-worst"
                            aria-hidden="true">#</a> MatchingResult.worst()</h3>
                    <ul>
                        <li>返回 {Match}</li>
                    </ul>
                    <p>相似度最低的匹配结果。如果没有任何匹配，则返回<code><span class="token keyword">null</span></code>。</p>
                    <h3 id="matchingresult-sortby-cmp" tabindex="-1"><a class="header-anchor"
                            href="./images.html#matchingresult-sortby-cmp"
                            aria-hidden="true">#</a> MatchingResult.sortBy(cmp)</h3>
                    <ul>
                        <li><code><span class="token property">cmp</span></code> {Function} | {string}
                            比较函数，或者是一个字符串表示排序方向。例如"left"表示将匹配结果按匹配位置从左往右排序、"top"表示将匹配结果按匹配位置从上往下排序，"left-top"表示将匹配结果按匹配位置从左往右、从上往下排序。方向包括<code><span class="token property">left</span></code>（左）,
                            <code><span class="token property">top</span></code> （上）,
                            <code><span class="token property">right</span></code> （右）,
                            <code><span class="token property">bottom</span></code>（下）。</li>
                        <li>{MatchingResult}</li>
                    </ul>
                    <p>对匹配结果进行排序，并返回排序后的结果。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token keyword">var</span> result <span class="token operator">=</span> images<span class="token punctuation">.</span><span class="token function">matchTemplate</span><span class="token punctuation">(</span>img<span class="token punctuation">,</span> template<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">max</span><span class="token operator">:</span> <span class="token number">100</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">log</span><span class="token punctuation">(</span>result<span class="token punctuation">.</span><span class="token function">sortBy</span><span class="token punctuation">(</span><span class="token string">"top-right"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h2 id="image" tabindex="-1"><a class="header-anchor"
                            href="./images.html#image" aria-hidden="true">#</a> Image
                    </h2>
                    <p>表示一张图片，可以是截图的图片，或者本地读取的图片，或者从网络获取的图片。</p>
                    <h3 id="image-getwidth" tabindex="-1"><a class="header-anchor"
                            href="./images.html#image-getwidth" aria-hidden="true">#</a>
                        Image.getWidth()</h3>
                    <p>返回以像素为单位图片宽度。</p>
                    <h3 id="image-getheight" tabindex="-1"><a class="header-anchor"
                            href="./images.html#image-getheight"
                            aria-hidden="true">#</a> Image.getHeight()</h3>
                    <p>返回以像素为单位的图片高度。</p>
                    <h3 id="image-saveto-path" tabindex="-1"><a class="header-anchor"
                            href="./images.html#image-saveto-path"
                            aria-hidden="true">#</a> Image.saveTo(path)</h3>
                    <ul>
                        <li><code><span class="token property">path</span></code> {string} 路径</li>
                    </ul>
                    <p>把图片保存到路径path。（如果文件存在则覆盖）</p>
                    <h3 id="image-pixel-x-y" tabindex="-1"><a class="header-anchor"
                            href="./images.html#image-pixel-x-y"
                            aria-hidden="true">#</a> Image.pixel(x, y)</h3>
                    <ul>
                        <li><code><span class="token property">x</span></code> {number} 横坐标</li>
                        <li><code><span class="token property">y</span></code> {number} 纵坐标</li>
                    </ul>
                    <p>返回图片image在点(x, y)处的像素的ARGB值。</p>
                    <p>该值的格式为0xAARRGGBB，是一个"32位整数"(虽然JavaScript中并不区分整数类型和其他数值类型)。</p>
                    <p>坐标系以图片左上角为原点。以图片左侧边为y轴，上侧边为x轴。</p>
                    <h2 id="point" tabindex="-1"><a class="header-anchor"
                            href="./images.html#point" aria-hidden="true">#</a> Point
                    </h2>
                    <p>findColor, findImage返回的对象。表示一个点（坐标）。</p>
                    <h3 id="point-x" tabindex="-1"><a class="header-anchor"
                            href="./images.html#point-x" aria-hidden="true">#</a>
                        Point.x</h3>
                    <p>横坐标。</p>
                    <h3 id="point-y" tabindex="-1"><a class="header-anchor"
                            href="./images.html#point-y" aria-hidden="true">#</a>
                        Point.y</h3>
                    <p>纵坐标。</p>
                    <h2 id="colormapping" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping" aria-hidden="true">#</a>
                        ColorMapping</h2>
                    <p>通过颜色映射的实现一种找色方式，对于同一张图找多次色，每次找色相比images模块里的函数非常快，只是需要相比一般找色需要一个初始化过程。</p>
                    <p>注意！ColorMapping仅能使用<strong>截图的图片对象</strong>初始化颜色映射。</p>
                    <p>初始化方式：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ColorMapping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截屏</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化颜色映射</span>
cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 使用完后及时回收</span>
cm<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>如果不想手动回收，可以用ColorMapping的单例，这个单例会自动在脚本结束时回收。</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> ColorMapping<span class="token punctuation">.</span>singleton<span class="token punctuation">;</span>
<span class="token comment">// 截屏</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化颜色映射</span>
cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 找色</span>
cm<span class="token punctuation">.</span><span class="token function">findColor</span><span class="token punctuation">(</span><span class="token string">"#ffffff"</span><span class="token punctuation">)</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h3 id="colormapping-singleton" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping-singleton"
                            aria-hidden="true">#</a> ColorMapping.singleton</h3>
                    <ul>
                        <li>{ColorMapping}</li>
                    </ul>
                    <p>ColorMapping的全局单例对象。</p>
                    <h3 id="colormapping-reset-img" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping-reset-img"
                            aria-hidden="true">#</a> ColorMapping.reset(img)</h3>
                    <ul>
                        <li><code><span class="token property">img</span></code> {Image} 截图</li>
                    </ul>
                    <p>此操作会重新初始化颜色映射的数据。</p>
                    <h3 id="colormapping-recycle" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping-recycle"
                            aria-hidden="true">#</a> ColorMapping.recycle()</h3>
                    <p>此操作会释放ColorMapping对象。</p>
                    <h3 id="colormapping-findcolor-color-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping-findcolor-color-options"
                            aria-hidden="true">#</a> ColorMapping.findColor(color[, options])</h3>
                    <ul>
                        <li><code><span class="token property">color</span></code> {number} | {string} 要检测的颜色</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                                <li><code><span class="token property">similarity</span></code> {number}
                                    找色时颜色相似度，范围为0~1（越大越相似，1为颜色相等，0为任何颜色都能匹配）。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    找色时颜色相似度的临界值，范围为0 ~
                                    255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255
                                    - threshold) / 255 。相似度与阈值二选一，同时存在则以相似度为准。</li>
                            </ul>
                        </li>
                        <li>返回 {Point}</li>
                    </ul>
                    <p>在图片中寻找颜色color。找到时返回找到的点Point，找不到时返回null。</p>
                    <p>一个同一张图多次找色的例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ColorMapping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 使用ColorMapping找色</span>
<span class="token keyword">while</span> <span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">// 截屏</span>
    <span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">// 初始化颜色映射</span>
    cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">let</span> p1 <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findColor</span><span class="token punctuation">(</span><span class="token string">"#ffffff"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>p1<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">// ...</span>
        console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"白色点坐标"</span> <span class="token operator">+</span> p1<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">continue</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">let</span> p2 <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findColor</span><span class="token punctuation">(</span><span class="token string">"#000000"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>p2<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">// ...</span>
        console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"黑色点坐标"</span> <span class="token operator">+</span> p2<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">continue</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token comment">// 释放ColorMapping</span>
cm<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <p>一个区域找色的例子如下：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ColorMapping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截屏</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化颜色映射</span>
cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 使用ColorMapping找色，指定找色区域为在位置(400, 500)的宽为300长为200的区域，指定找色临界值为4</span>
<span class="token keyword">let</span> point <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findColor</span><span class="token punctuation">(</span><span class="token string">"#00ff00"</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
     <span class="token literal-property property">region</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">400</span><span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
     <span class="token literal-property property">threshold</span><span class="token operator">:</span> <span class="token number">4</span>
 <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>point<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"找到啦:"</span> <span class="token operator">+</span> point<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
    <span class="token function">toast</span><span class="token punctuation">(</span><span class="token string">"没找到"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">// 释放ColorMapping</span>
cm<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h3 id="colormapping-findmulticolors-firstcolor-colors-options" tabindex="-1"><a
                            class="header-anchor"
                            href="./images.html#colormapping-findmulticolors-firstcolor-colors-options"
                            aria-hidden="true">#</a> ColorMapping.findMultiColors(firstColor, colors, options)</h3>
                    <ul>
                        <li><code><span class="token property">firstColor</span></code> {number} | {string} 第一个点的颜色</li>
                        <li><code><span class="token property">colors</span></code> {Array}
                            表示剩下的点相对于第一个点的位置和颜色的数组，数组的每个元素为[x, y, color]</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项，包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    找色时颜色相似度的临界值，范围为0 ~
                                    255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为 similarity = (255
                                    - threshold) / 255。</li>
                            </ul>
                        </li>
                        <li>返回 {Point}</li>
                    </ul>
                    <p>多点找色，与images.findMultiColors类似,但多次在同一张图片中找色速度极快。</p>
                    <p>一个同一张图片多次多点找色的例子：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ColorMapping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截屏</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化颜色映射</span>
cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 使用ColorMapping多点找色</span>
<span class="token keyword">let</span> p1 <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findMultiColors</span><span class="token punctuation">(</span><span class="token string">"#ff00ff"</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token string">"#ffffff"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">40</span><span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">let</span> p2 <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findMultiColors</span><span class="token punctuation">(</span><span class="token string">"#ff00ff"</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token string">"#ffffff"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">40</span><span class="token punctuation">,</span> <span class="token string">"#000000"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"p1"</span> <span class="token operator">+</span> p1 <span class="token operator">+</span> <span class="token string">"p2"</span> <span class="token operator">+</span> p2<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 释放ColorMapping</span>
cm<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                    <h3 id="colormapping-findallpointsforcolor-color-options" tabindex="-1"><a class="header-anchor"
                            href="./images.html#colormapping-findallpointsforcolor-color-options"
                            aria-hidden="true">#</a> ColorMapping.findAllPointsForColor(color, options)</h3>
                    <ul>
                        <li><code><span class="token property">color</span></code> {number} | {string} 要检测的颜色</li>
                        <li><code><span class="token property">options</span></code> {Object} 选项包括： <ul>
                                <li><code><span class="token property">region</span></code> {Array}
                                    找色区域。是一个两个或四个元素的数组。(region[0],
                                    region[1])表示找色区域的左上角；region[2]*region[3]表示找色区域的宽高。如果只有region只有两个元素，则找色区域为(region[0],
                                    region[1])到图片右下角。如果不指定region选项，则找色区域为整张图片。</li>
                                <li><code><span class="token property">similarity</span></code> {number}
                                    找色时颜色相似度，范围为0~1（越大越相似，1为颜色相等，0为任何颜色都能匹配）。</li>
                                <li><code><span class="token property">threshold</span></code> {number}
                                    找色时颜色相似度的临界值，范围为0—255（越小越相似，0为颜色相等，255为任何颜色都能匹配）。默认为4。threshold和浮点数相似度(0.0~1.0)的换算为
                                    similarity = (255 - threshold) / 255 。相似度与阈值二选一，同时存在则以相似度为准。</li>
                            </ul>
                        </li>
                        <li>返回 {Array}</li>
                    </ul>
                    <p>在图片中寻找所有颜色为color的点。找到时返回找到的点Point的数组，找不到时返回null。</p>
                    <p>找出所有白色点和所有黑色点的例子：</p>
                    <div class="language-javascript ext-js line-numbers-mode"><button class="copy" aria-label="复制代码"
                            data-copied="已复制" data-balloon-pos="left">
                            <div class="copy-icon"></div>
                        </button>
                        <pre class="language-javascript" copy-code-registered=""><code><span class="token comment">// 申请截图权限</span>
$images<span class="token punctuation">.</span><span class="token function">requestScreenCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化ColorMapping</span>
<span class="token keyword">let</span> ColorMapping <span class="token operator">=</span> $colors<span class="token punctuation">.</span>mapping<span class="token punctuation">;</span>
<span class="token comment">// 创建ColorMapping实例</span>
<span class="token keyword">let</span> cm <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ColorMapping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 截屏</span>
<span class="token keyword">let</span> img <span class="token operator">=</span> $images<span class="token punctuation">.</span><span class="token function">captureScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 初始化颜色映射</span>
cm<span class="token punctuation">.</span><span class="token function">reset</span><span class="token punctuation">(</span>img<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 使用ColorMapping多点找色</span>
<span class="token keyword">let</span> whitePoints <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findAllPointsForColor</span><span class="token punctuation">(</span><span class="token string">"#ffffff"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">let</span> blackPoints <span class="token operator">=</span> cm<span class="token punctuation">.</span><span class="token function">findAllPointsForColor</span><span class="token punctuation">(</span><span class="token string">"#000000"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>whitePoints <span class="token operator">!=</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"白色点有"</span> <span class="token operator">+</span> whitePoints<span class="token punctuation">.</span>length <span class="token operator">+</span> <span class="token string">"个"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
    <span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"未找到白色点"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>blackPoints <span class="token operator">!=</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"黑色点有"</span> <span class="token operator">+</span> blackPoints<span class="token punctuation">.</span>length <span class="token operator">+</span> <span class="token string">"个"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
    <span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"未找到黑色点"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">// 释放ColorMapping</span>
cm<span class="token punctuation">.</span><span class="token function">recycle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
                        <div class="line-numbers" aria-hidden="true">
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                            <div class="line-number"></div>
                        </div>
                    </div>
                </div><!---->
                <footer class="page-meta"><!---->
                    <div class="meta-item update-time"><span class="label">上次编辑于: </span><span class="info">2022/10/23
                            21:32:46</span></div>
                    <div class="meta-item contributors"><span class="label">贡献者: </span><span class="contributor"
                            title="email: 946994919@qq.com">hyb1996</span></div>
                </footer>
                <nav class="page-nav"><a href="./http.html" class="nav-link prev"
                        aria-label="http - HTTP网络请求">
                        <div class="hint"><span class="arrow left"></span>上一页</div>
                        <div class="link"><!---->http - HTTP网络请求</div>
                    </a><a href="./keys.html" class="nav-link next"
                        aria-label="keys - 按键模拟">
                        <div class="hint">下一页<span class="arrow right"></span></div>
                        <div class="link">keys - 按键模拟<!----></div>
                    </a></nav><!----><!---->
            </main><!--]--><!----><!--]-->
        </div><!--]--><button class="back-to-top" aria-label="返回顶部" data-balloon-pos="left"><svg
                xmlns="http://www.w3.org/2000/svg" class="icon back-to-top-icon" viewBox="0 0 1024 1024"
                fill="currentColor" aria-label="back-to-top icon">
                <path
                    d="M512 843.2c-36.2 0-66.4-13.6-85.8-21.8-10.8-4.6-22.6 3.6-21.8 15.2l7 102c.4 6.2 7.6 9.4 12.6 5.6l29-22c3.6-2.8 9-1.8 11.4 2l41 64.2c3 4.8 10.2 4.8 13.2 0l41-64.2c2.4-3.8 7.8-4.8 11.4-2l29 22c5 3.8 12.2.6 12.6-5.6l7-102c.8-11.6-11-20-21.8-15.2-19.6 8.2-49.6 21.8-85.8 21.8z">
                </path>
                <path
                    d="m795.4 586.2-96-98.2C699.4 172 513 32 513 32S324.8 172 324.8 488l-96 98.2c-3.6 3.6-5.2 9-4.4 14.2L261.2 824c1.8 11.4 14.2 17 23.6 10.8L419 744s41.4 40 94.2 40c52.8 0 92.2-40 92.2-40l134.2 90.8c9.2 6.2 21.6.6 23.6-10.8l37-223.8c.4-5.2-1.2-10.4-4.8-14zM513 384c-34 0-61.4-28.6-61.4-64s27.6-64 61.4-64c34 0 61.4 28.6 61.4 64S547 384 513 384z">
                </path>
            </svg></button><button class="sw-update-popup" tabindex="0">新内容已就绪<span class="icon-wrapper"><svg
                    xmlns="http://www.w3.org/2000/svg" class="icon update-icon" viewBox="0 0 1024 1024"
                    fill="currentColor" aria-label="update icon">
                    <path
                        d="M949.949 146.25v255.826c0 21.981-13.989 35.97-35.97 35.97H658.154c-13.988 0-25.983-7.992-33.973-21.981-5.997-13.989-4-27.977 7.991-39.97l79.942-77.946c-55.954-51.973-121.918-77.955-199.863-77.955-37.975 0-75.95 8.002-113.924 21.99-37.975 15.985-67.948 37.976-91.934 63.957-25.982 23.987-47.973 53.96-63.957 91.934-29.983 73.955-29.983 153.895 0 227.85 15.984 37.976 37.975 67.947 63.957 91.934 23.986 25.982 53.959 47.973 91.934 63.956 37.974 13.989 75.95 21.991 113.924 21.991 45.967 0 87.942-9.998 127.913-29.982 41.976-17.99 75.951-45.967 101.931-83.943 7.993-4 11.994-5.995 13.989-5.995 5.997 0 9.998 1.994 13.988 5.995l77.958 77.946c3.989 4 5.986 7.993 5.986 11.994 0 1.994-1.996 5.995-3.99 11.994-43.973 51.962-93.941 91.934-151.9 117.914-53.958 25.983-115.92 39.972-185.874 39.972-61.961 0-119.921-11.984-169.89-33.973-57.96-25.985-105.923-57.963-139.896-93.943-35.98-33.972-67.958-81.936-93.94-139.897-45.967-101.93-45.967-237.846 0-339.777 25.982-57.96 57.96-105.923 93.94-139.896 33.973-35.98 81.936-67.958 139.896-93.94 49.968-21.99 107.928-33.974 169.89-33.974 55.963 0 109.923 9.988 161.885 29.973 53.97 21.99 101.933 51.963 139.908 89.938l73.954-73.944c9.987-9.998 23.987-13.988 39.971-8.002 13.988 8.002 21.98 19.995 21.98 33.984z">
                    </path>
                </svg></span></button><!--]-->
    </div>
    <script type="module" src="./images - 图片处理 _ Auto.js Pro文档_files/app.486b1949.js.下载" defer=""></script>


    <div id="message-container"></div>
</body>
<div id="photoShowViewer" class="sb_BingCA photoShow" style="transition: all 0.2s ease-out 0s; opacity: 0;">
    <div class="photoshow-viewer-shadow" style="transition: all 0.2s ease-out 0s;"></div>
    <div class="photoshow-img-wrapper">
        <img>
        <div class="photoshow-view-mode-switch-tip">a</div>
    </div>
    <i class="photoshow-img-size"></i>
</div>

</html>